Mercurial > hg > ristipolku
annotate game/Engine.java @ 51:f81f76458b92
Work on widgets.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 23 Feb 2011 02:49:07 +0200 |
parents | 496e616ff09d |
children | 01851bae3da3 |
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 | |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
292 // UI IDM widgets |
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(); |
51 | 294 |
295 widgets.add(new BtnNewGame(0.75f, 0.75f)); | |
296 widgets.add(new BtnSwapPiece(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 | |
335 // Rescale background if component size has changed | |
336 Dimension dim = getSize(); | |
337 if (lautaDim == null || !dim.equals(lautaDim)) | |
338 { | |
339 lautaBGScaled = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB); | |
340 Graphics2D gimg = lautaBGScaled.createGraphics(); | |
341 gimg.setRenderingHint(RenderingHints.KEY_INTERPOLATION, | |
342 RenderingHints.VALUE_INTERPOLATION_BICUBIC); | |
343 | |
344 gimg.drawImage(lautaBG, 0, 0, dim.width, dim.height, null); | |
345 lautaDim = dim; | |
346 | |
51 | 347 widgets.setScale(dim.width, dim.height); |
25 | 348 System.out.print("scale changed\n"); |
349 } | |
350 | |
351 // Background, pieces | |
352 g2.drawImage(lautaBGScaled, 0, 0, null); | |
353 lauta.paint(g2, 100, 150, 60); | |
50 | 354 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
|
355 |
25 | 356 // Scores |
357 g2.setFont(font1); | |
358 g2.setPaint(Color.white); | |
50 | 359 |
25 | 360 long currTime = new Date().getTime(); |
32
e480579cc460
More work on debugging the path resolving.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
361 g2.drawString("fps = "+ ((gameFrames * 1000) / (currTime - startTime)), dim.width - 120, 20); |
25 | 362 } |
363 | |
8 | 364 public void startThreads() |
365 { | |
9 | 366 System.out.print("startThreads()\n"); |
8 | 367 if (animThread == null) |
368 { | |
369 animThread = new Thread(this); | |
370 animEnable = true; | |
371 animThread.start(); | |
372 } | |
373 } | |
374 | |
375 public void stopThreads() | |
376 { | |
9 | 377 System.out.print("stopThreads()\n"); |
37 | 378 |
379 // Stop animations | |
8 | 380 if (animThread != null) |
381 { | |
382 animThread.interrupt(); | |
383 animEnable = false; | |
384 animThread = null; | |
385 } | |
22 | 386 |
37 | 387 // Shut down sound manager |
47 | 388 soundManager.close(); |
2 | 389 } |
0 | 390 |
18 | 391 public void mouseEntered(MouseEvent e) { } |
392 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
|
393 |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
394 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
|
395 { |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
396 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
|
397 } |
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 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
|
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.mouseReleased(e); |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
402 } |
18 | 403 |
404 public void mouseClicked(MouseEvent e) | |
405 { | |
406 System.out.print("mouseClicked()\n"); | |
407 if (!hasFocus()) | |
408 { | |
409 System.out.print("requesting focus\n"); | |
410 requestFocus(); | |
411 } | |
412 } | |
413 | |
9 | 414 public void keyTyped(KeyEvent e) |
2 | 415 { |
416 } | |
1 | 417 |
2 | 418 public void keyReleased(KeyEvent e) |
419 { | |
420 } | |
1 | 421 |
9 | 422 public void keyPressed(KeyEvent e) |
2 | 423 { |
26
3d4cc47df31a
Cleanups, fix piece rendering and rotation.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
424 // 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
|
425 if (lauta.keyPressed(e)) |
47 | 426 return; |
427 | |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
428 widgets.keyPressed(e); |
2 | 429 } |
8 | 430 |
431 public void run() | |
432 { | |
433 while (animEnable) | |
434 { | |
26
3d4cc47df31a
Cleanups, fix piece rendering and rotation.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
435 // Progress game animation clock |
25 | 436 gameClock++; |
9 | 437 |
26
3d4cc47df31a
Cleanups, fix piece rendering and rotation.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
438 // Animate components |
25 | 439 lauta.animate(gameClock); |
9 | 440 |
26
3d4cc47df31a
Cleanups, fix piece rendering and rotation.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
441 // Repaint with a frame limiter |
25 | 442 if (gameClock % 3 == 1) |
24 | 443 { |
10 | 444 repaint(); |
25 | 445 gameFrames++; |
24 | 446 } |
32
e480579cc460
More work on debugging the path resolving.
Matti Hamalainen <ccr@tnsp.org>
parents:
30
diff
changeset
|
447 |
26
3d4cc47df31a
Cleanups, fix piece rendering and rotation.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
448 // Sleep for a moment |
9 | 449 try { |
450 Thread.sleep(10); | |
451 } | |
452 catch (InterruptedException x) { | |
453 } | |
8 | 454 } |
455 } | |
49
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
456 |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
457 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
|
458 { |
51 | 459 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
|
460 { |
51 | 461 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
|
462 } |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
463 |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
464 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
|
465 { |
e6da5c71be28
Add more code to IDM widgets, do preliminary work for integrating them.
Matti Hamalainen <ccr@tnsp.org>
parents:
48
diff
changeset
|
466 startNewGame(); |
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 } |
50 | 469 |
470 class BtnSwapPiece extends IDMButton | |
471 { | |
51 | 472 public BtnSwapPiece(float x, float y) |
50 | 473 { |
51 | 474 super(x, y, KeyEvent.VK_SPACE, font1, "Vaihda"); |
50 | 475 } |
476 | |
477 public void clicked() | |
478 { | |
479 } | |
480 } | |
0 | 481 } |