Mercurial > hg > ristipolku
annotate game/Engine.java @ 52:01851bae3da3
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 23 Feb 2011 11:50:18 +0200 |
parents | f81f76458b92 |
children | 6bf4675e2d96 |
rev | line source |
---|---|
0 | 1 /* |
9 | 2 * Ristipolku Game Engine |
0 | 3 * (C) Copyright 2011 Matti 'ccr' Hämäläinen <ccr@tnsp.org> |
4 */ | |
9 | 5 package game; |
6 | |
0 | 7 import java.awt.*; |
8 import java.awt.geom.*; | |
1 | 9 import java.awt.event.*; |
7 | 10 import java.awt.image.*; |
11 import java.awt.event.*; | |
25 | 12 import java.awt.font.*; |
9 | 13 import javax.imageio.*; |
7 | 14 import javax.swing.*; |
1 | 15 import java.util.*; |
6 | 16 import java.io.*; |
1 | 17 import game.*; |
37 | 18 import javax.sound.sampled.*; |
21 | 19 |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
20 |
8 | 21 /* |
22 class AnimatedElement | |
23 { | |
24 float x, y, stime, value; | |
25 Interpolate lerp; | |
26 boolean active; | |
27 | |
28 public AnimatedElement(float x, float y, ) | |
29 { | |
30 stime = 0; | |
31 this.x = x; | |
32 this.y = y; | |
33 | |
34 } | |
35 | |
36 public animate(float time) | |
37 { | |
38 if (!active) | |
39 { | |
40 active = true; | |
41 stime = time; | |
42 } | |
43 | |
44 float t = (time - stime) / 10.0f; | |
45 if (t < 100) | |
46 value = lerp.getValue(t); | |
47 else | |
48 { | |
49 | |
50 } | |
51 } | |
52 | |
53 public paint(Graphics2D g, ); | |
54 { | |
55 } | |
56 } | |
57 */ | |
0 | 58 |
48 | 59 class GameBoard extends IDMWidget |
0 | 60 { |
2 | 61 public static final int boardSize = 9; |
62 public static final int boardMiddle = 4; | |
63 Piece[][] board; | |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
64 |
8 | 65 public boolean flagGameOver; |
7 | 66 |
41 | 67 Piece currPiece; |
68 int currX, currY, currPoint; | |
9 | 69 |
48 | 70 int score; |
71 | |
47 | 72 SoundManager soundManager; |
73 Sound sndPlaced; | |
74 | |
75 public GameBoard(SoundManager smgr) | |
2 | 76 { |
77 board = new Piece[boardSize][boardSize]; | |
78 | |
79 board[boardMiddle][boardMiddle] = new Piece(PieceType.START); | |
80 | |
41 | 81 currX = boardMiddle; |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
82 currY = boardMiddle; |
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
83 currPoint = 0; |
8 | 84 |
9 | 85 pieceFinishTurn(); |
8 | 86 |
87 flagGameOver = false; | |
48 | 88 score = 0; |
47 | 89 |
90 soundManager = smgr; | |
50 | 91 // sndPlaced = soundManager.getSound("sounds/placed.wav"); |
2 | 92 } |
0 | 93 |
51 | 94 public void paint(Graphics2D g, float sx, float sy, float scale) |
2 | 95 { |
96 for (int y = 0; y < boardSize; y++) | |
97 for (int x = 0; x < boardSize; x++) | |
98 if (board[x][y] != null) | |
99 { | |
6 | 100 AffineTransform save = g.getTransform(); |
101 | |
4 | 102 board[x][y].paint(g, |
103 sx + (x * scale), | |
104 sy + (y * scale), | |
105 scale - scale / 10); | |
6 | 106 |
107 g.setTransform(save); | |
2 | 108 } |
109 } | |
9 | 110 |
111 public void animate(float time) | |
112 { | |
113 for (int y = 0; y < boardSize; y++) | |
114 for (int x = 0; x < boardSize; x++) | |
115 if (board[x][y] != null) | |
116 { | |
117 board[x][y].animate(time); | |
118 } | |
119 } | |
1 | 120 |
32
e480579cc460
More work on debugging the path resolving.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
121 public void pieceRotate(Piece.RotateDir dir) |
2 | 122 { |
41 | 123 if (currPiece != null) |
124 currPiece.rotate(dir); | |
2 | 125 } |
1 | 126 |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
127 private void pieceMoveTo(int point) |
7 | 128 { |
46 | 129 switch (point) |
130 { | |
131 case 0: currY--; break; | |
132 case 1: currY--; break; | |
133 | |
134 case 2: currX++; break; | |
135 case 3: currX++; break; | |
136 | |
137 case 4: currY++; break; | |
138 case 5: currY++; break; | |
139 | |
140 case 6: currX--; break; | |
141 case 7: currX--; break; | |
142 } | |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
143 } |
9 | 144 |
48 | 145 public boolean pieceCheck(Piece curr) |
146 { | |
147 if (curr == null) | |
148 { | |
149 // Create new piece | |
150 currPiece = new Piece(PieceType.ACTIVE); | |
151 board[currX][currY] = currPiece; | |
152 return true; | |
153 } | |
154 else | |
155 if (curr.getType() == PieceType.START) | |
156 { | |
157 if (currPiece != null) | |
158 { | |
159 // Hit center starting piece, game over | |
160 flagGameOver = true; | |
161 currPiece = null; | |
162 System.out.print("GameOver!\n"); | |
163 return true; | |
164 } | |
165 else | |
166 { | |
167 // Start piece as first piece means game is starting | |
168 pieceMoveTo(currPoint); | |
169 currPiece = new Piece(PieceType.ACTIVE); | |
170 board[currX][currY] = currPiece; | |
171 return true; | |
172 } | |
173 } | |
174 | |
175 // Mark the current piece as locked | |
176 curr.setType(PieceType.LOCKED); | |
177 | |
178 // Solve connection (with rotations) through the piece | |
179 currPoint = curr.getRotatedPoint(curr.getMatchingPoint(currPoint)); | |
180 | |
181 // Mark connection as active | |
182 curr.setConnectionState(currPoint, true); | |
183 | |
184 // Solve exit point (with rotations) | |
185 currPoint = curr.getAntiRotatedPoint(curr.getConnection(currPoint)); | |
186 | |
187 // Move to next position accordingly | |
188 pieceMoveTo(currPoint); | |
189 return false; | |
190 } | |
191 | |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
192 public void pieceFinishTurn() |
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
193 { |
48 | 194 boolean finished = false; |
195 while (!finished) | |
7 | 196 { |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
197 if (currX >= 0 && currX < boardSize && currY >= 0 && currY < boardSize) |
27 | 198 { |
48 | 199 finished = pieceCheck(board[currX][currY]); |
27 | 200 } |
201 else | |
202 { | |
46 | 203 // Outside of the board, game over |
48 | 204 finished = true; |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
205 flagGameOver = true; |
47 | 206 currPiece = null; |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
207 System.out.print("GameOver!\n"); |
7 | 208 } |
209 } | |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
210 } |
47 | 211 |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
212 public boolean keyPressed(KeyEvent e) |
47 | 213 { |
214 switch (e.getKeyCode()) | |
215 { | |
216 case KeyEvent.VK_LEFT: | |
217 case KeyEvent.VK_UP: | |
218 pieceRotate(Piece.RotateDir.LEFT); | |
219 return true; | |
220 | |
221 case KeyEvent.VK_RIGHT: | |
222 case KeyEvent.VK_DOWN: | |
223 pieceRotate(Piece.RotateDir.RIGHT); | |
224 return true; | |
225 | |
226 case KeyEvent.VK_ENTER: | |
227 soundManager.play(sndPlaced); | |
228 pieceFinishTurn(); | |
229 return true; | |
230 } | |
231 return false; | |
232 } | |
1 | 233 } |
234 | |
235 | |
9 | 236 public class Engine extends JPanel |
18 | 237 implements Runnable, KeyListener, MouseListener |
1 | 238 { |
25 | 239 long startTime; |
240 float gameClock, gameFrames; | |
8 | 241 Thread animThread; |
242 boolean animEnable = false; | |
25 | 243 |
244 Font fontMain, font1, font2; | |
4 | 245 GameBoard lauta = null; |
9 | 246 BufferedImage lautaBG = null, lautaBGScaled = null; |
25 | 247 Dimension lautaDim; |
22 | 248 |
37 | 249 static final AudioFormat sfmt = new AudioFormat(22050, 16, 1, true, false); |
47 | 250 SoundManager soundManager; |
251 Sound musa; | |
1 | 252 |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
253 IDMContainer widgets; |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
254 |
9 | 255 public Engine() |
2 | 256 { |
25 | 257 // Initialize globals |
258 System.out.print("Engine() constructor\n"); | |
259 | |
37 | 260 // Sound system |
47 | 261 soundManager = new SoundManager(sfmt, 16); |
9 | 262 |
25 | 263 // Load resources |
4 | 264 try |
265 { | |
24 | 266 ResourceLoader res = new ResourceLoader("graphics/board.jpg"); |
18 | 267 lautaBG = ImageIO.read(res.getStream()); |
21 | 268 |
25 | 269 try { |
270 res = new ResourceLoader("graphics/font.ttf"); | |
271 fontMain = Font.createFont(Font.TRUETYPE_FONT, res.getStream()); | |
272 font1 = fontMain.deriveFont(24f); | |
273 font2 = fontMain.deriveFont(32f); | |
274 } | |
275 catch (FontFormatException e) | |
276 { | |
277 System.out.print("Could not initialize fonts.\n"); | |
278 } | |
37 | 279 |
42
951a4d669af0
Initially working path solving algorithm.
Matti Hamalainen <ccr@tnsp.org>
parents:
41
diff
changeset
|
280 // musa = smgr.getSound("sounds/gamemusic.wav"); |
4 | 281 } |
282 catch (IOException e) | |
283 { | |
284 JOptionPane.showMessageDialog(null, | |
21 | 285 e.getMessage(), |
4 | 286 "Initialization error", |
287 JOptionPane.ERROR_MESSAGE); | |
37 | 288 |
21 | 289 System.out.print(e.getMessage()); |
18 | 290 } |
291 | |
52 | 292 // Create IDM GUI widgets |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
293 widgets = new IDMContainer(); |
52 | 294 |
295 widgets.add(new BtnSwapPiece(0.75f, 0.60f)); | |
296 widgets.add(new BtnNewGame(0.75f, 0.85f)); | |
50 | 297 |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
298 // Game |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
299 startNewGame(); |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
300 |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
301 // Initialize event listeners |
18 | 302 addKeyListener(this); |
303 addMouseListener(this); | |
304 | |
305 // Get initial focus | |
306 if (!hasFocus()) | |
307 { | |
308 System.out.print("Engine(): requesting focus\n"); | |
309 requestFocus(); | |
4 | 310 } |
37 | 311 |
47 | 312 soundManager.play(musa); |
8 | 313 } |
314 | |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
315 public void startNewGame() |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
316 { |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
317 gameClock = 0; |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
318 gameFrames = 0; |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
319 startTime = new Date().getTime(); |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
320 |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
321 lauta = new GameBoard(soundManager); |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
322 } |
25 | 323 |
324 public void paintComponent(Graphics g) | |
325 { | |
326 Graphics2D g2 = (Graphics2D) g; | |
327 | |
328 // Use antialiasing when rendering the game elements | |
329 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, | |
330 RenderingHints.VALUE_ANTIALIAS_ON); | |
331 | |
332 g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, | |
333 RenderingHints.VALUE_TEXT_ANTIALIAS_ON); | |
334 | |
52 | 335 // Rescale if parent component size has changed |
25 | 336 Dimension dim = getSize(); |
337 if (lautaDim == null || !dim.equals(lautaDim)) | |
338 { | |
52 | 339 // Rescale background image |
25 | 340 lautaBGScaled = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB); |
341 Graphics2D gimg = lautaBGScaled.createGraphics(); | |
342 gimg.setRenderingHint(RenderingHints.KEY_INTERPOLATION, | |
343 RenderingHints.VALUE_INTERPOLATION_BICUBIC); | |
344 | |
345 gimg.drawImage(lautaBG, 0, 0, dim.width, dim.height, null); | |
346 lautaDim = dim; | |
347 | |
52 | 348 // Rescale IDM GUI widgets |
51 | 349 widgets.setScale(dim.width, dim.height); |
52 | 350 |
25 | 351 System.out.print("scale changed\n"); |
352 } | |
353 | |
52 | 354 // Background image, pieces |
25 | 355 g2.drawImage(lautaBGScaled, 0, 0, null); |
52 | 356 lauta.paint(g2, 90, 140, 65); |
50 | 357 widgets.paint(g2); |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
358 |
52 | 359 // Scores, etc |
25 | 360 g2.setFont(font1); |
361 g2.setPaint(Color.white); | |
50 | 362 |
25 | 363 long currTime = new Date().getTime(); |
32
e480579cc460
More work on debugging the path resolving.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
364 g2.drawString("fps = "+ ((gameFrames * 1000) / (currTime - startTime)), dim.width - 120, 20); |
25 | 365 } |
366 | |
8 | 367 public void startThreads() |
368 { | |
9 | 369 System.out.print("startThreads()\n"); |
8 | 370 if (animThread == null) |
371 { | |
372 animThread = new Thread(this); | |
373 animEnable = true; | |
374 animThread.start(); | |
375 } | |
376 } | |
377 | |
378 public void stopThreads() | |
379 { | |
9 | 380 System.out.print("stopThreads()\n"); |
37 | 381 |
382 // Stop animations | |
8 | 383 if (animThread != null) |
384 { | |
385 animThread.interrupt(); | |
386 animEnable = false; | |
387 animThread = null; | |
388 } | |
22 | 389 |
37 | 390 // Shut down sound manager |
47 | 391 soundManager.close(); |
2 | 392 } |
0 | 393 |
18 | 394 public void mouseEntered(MouseEvent e) { } |
395 public void mouseExited(MouseEvent e) { } | |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
396 |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
397 public void mousePressed(MouseEvent e) |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
398 { |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
399 widgets.mousePressed(e); |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
400 } |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
401 |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
402 public void mouseReleased(MouseEvent e) |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
403 { |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
404 widgets.mouseReleased(e); |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
405 } |
18 | 406 |
407 public void mouseClicked(MouseEvent e) | |
408 { | |
409 System.out.print("mouseClicked()\n"); | |
410 if (!hasFocus()) | |
411 { | |
412 System.out.print("requesting focus\n"); | |
413 requestFocus(); | |
414 } | |
415 } | |
416 | |
9 | 417 public void keyTyped(KeyEvent e) |
2 | 418 { |
419 } | |
1 | 420 |
2 | 421 public void keyReleased(KeyEvent e) |
422 { | |
423 } | |
1 | 424 |
9 | 425 public void keyPressed(KeyEvent e) |
2 | 426 { |
26
3d4cc47df31a
Cleanups, fix piece rendering and rotation.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
427 // Handle keyboard input |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
428 if (lauta.keyPressed(e)) |
47 | 429 return; |
430 | |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
431 widgets.keyPressed(e); |
2 | 432 } |
8 | 433 |
434 public void run() | |
435 { | |
436 while (animEnable) | |
437 { | |
26
3d4cc47df31a
Cleanups, fix piece rendering and rotation.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
438 // Progress game animation clock |
25 | 439 gameClock++; |
9 | 440 |
26
3d4cc47df31a
Cleanups, fix piece rendering and rotation.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
441 // Animate components |
25 | 442 lauta.animate(gameClock); |
9 | 443 |
26
3d4cc47df31a
Cleanups, fix piece rendering and rotation.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
444 // Repaint with a frame limiter |
25 | 445 if (gameClock % 3 == 1) |
24 | 446 { |
10 | 447 repaint(); |
25 | 448 gameFrames++; |
24 | 449 } |
32
e480579cc460
More work on debugging the path resolving.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
450 |
26
3d4cc47df31a
Cleanups, fix piece rendering and rotation.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
451 // Sleep for a moment |
9 | 452 try { |
453 Thread.sleep(10); | |
454 } | |
455 catch (InterruptedException x) { | |
456 } | |
8 | 457 } |
458 } | |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
459 |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
460 class BtnNewGame extends IDMButton |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
461 { |
51 | 462 public BtnNewGame(float x, float y) |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
463 { |
51 | 464 super(x, y, KeyEvent.VK_ESCAPE, font1, "Uusi peli"); |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
465 } |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
466 |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
467 public void clicked() |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
468 { |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
469 startNewGame(); |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
470 } |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
471 } |
50 | 472 |
473 class BtnSwapPiece extends IDMButton | |
474 { | |
51 | 475 public BtnSwapPiece(float x, float y) |
50 | 476 { |
51 | 477 super(x, y, KeyEvent.VK_SPACE, font1, "Vaihda"); |
50 | 478 } |
479 | |
480 public void clicked() | |
481 { | |
482 } | |
483 } | |
0 | 484 } |