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