Mercurial > hg > ristipolku
comparison game/Engine.java @ 23:0741dc117808
Remove sound code for later refactoring.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 01 Feb 2011 09:55:09 +0200 |
parents | afde253ec705 |
children | 1be98362e5e9 |
comparison
equal
deleted
inserted
replaced
22:afde253ec705 | 23:0741dc117808 |
---|---|
199 GameBoard lauta = null; | 199 GameBoard lauta = null; |
200 BufferedImage lautaBG = null, lautaBGScaled = null; | 200 BufferedImage lautaBG = null, lautaBGScaled = null; |
201 Dimension oldDim; | 201 Dimension oldDim; |
202 float clock; | 202 float clock; |
203 | 203 |
204 /* | |
205 SoundElement[] sounds; | 204 SoundElement[] sounds; |
206 public SoundElement snd(Sound snd) | 205 public SoundElement snd(Sound snd) |
207 { | 206 { |
208 return sounds[snd.ordinal()]; | 207 return sounds[snd.ordinal()]; |
209 } | 208 } |
210 */ | |
211 | 209 |
212 public Engine() | 210 public Engine() |
213 { | 211 { |
214 BufferedImage img; | 212 BufferedImage img; |
215 clock = 0; | 213 clock = 0; |
219 try | 217 try |
220 { | 218 { |
221 ResourceLoader res = new ResourceLoader("graphics/board.png"); | 219 ResourceLoader res = new ResourceLoader("graphics/board.png"); |
222 lautaBG = ImageIO.read(res.getStream()); | 220 lautaBG = ImageIO.read(res.getStream()); |
223 | 221 |
224 /* | |
225 sounds = new SoundElement[16]; | 222 sounds = new SoundElement[16]; |
226 for (Sound s : Sound.values()) | 223 for (Sound s : Sound.values()) |
227 { | 224 { |
228 System.out.print(s +" = "+ s.ordinal() +"\n"); | 225 System.out.print(s +" = "+ s.ordinal() +"\n"); |
229 sounds[s.ordinal()] = new SoundElement("sounds/" + s.getName(), s.isEffect()); | 226 sounds[s.ordinal()] = new SoundElement("sounds/" + s.getName(), s.isStreaming()); |
230 } | 227 } |
231 */ | |
232 } | 228 } |
233 catch (IOException e) | 229 catch (IOException e) |
234 { | 230 { |
235 /* | 231 /* |
236 JOptionPane.showMessageDialog(null, | 232 JOptionPane.showMessageDialog(null, |
250 { | 246 { |
251 System.out.print("Engine(): requesting focus\n"); | 247 System.out.print("Engine(): requesting focus\n"); |
252 requestFocus(); | 248 requestFocus(); |
253 } | 249 } |
254 | 250 |
255 /* | |
256 snd(Sound.MUSIC_GAME1).loop(-1); | 251 snd(Sound.MUSIC_GAME1).loop(-1); |
257 */ | |
258 } | 252 } |
259 | 253 |
260 public void startThreads() | 254 public void startThreads() |
261 { | 255 { |
262 System.out.print("startThreads()\n"); | 256 System.out.print("startThreads()\n"); |
276 animThread.interrupt(); | 270 animThread.interrupt(); |
277 animEnable = false; | 271 animEnable = false; |
278 animThread = null; | 272 animThread = null; |
279 } | 273 } |
280 | 274 |
281 /* | |
282 for (Sound s : Sound.values()) | 275 for (Sound s : Sound.values()) |
283 { | 276 { |
284 if (snd(s) != null) | 277 if (snd(s) != null) |
285 snd(s).stop(); | 278 snd(s).stop(); |
286 } | 279 } |
287 */ | |
288 } | 280 } |
289 | 281 |
290 public void mousePressed(MouseEvent e) { } | 282 public void mousePressed(MouseEvent e) { } |
291 public void mouseEntered(MouseEvent e) { } | 283 public void mouseEntered(MouseEvent e) { } |
292 public void mouseExited(MouseEvent e) { } | 284 public void mouseExited(MouseEvent e) { } |
353 lauta.pieceRotate(true); | 345 lauta.pieceRotate(true); |
354 break; | 346 break; |
355 | 347 |
356 case KeyEvent.VK_ENTER: | 348 case KeyEvent.VK_ENTER: |
357 lauta.pieceFinishTurn(); | 349 lauta.pieceFinishTurn(); |
358 // snd(Sound.PIECE_PLACED).stop(); | 350 snd(Sound.PIECE_PLACED).stop(); |
359 // snd(Sound.PIECE_PLACED).play(); | 351 snd(Sound.PIECE_PLACED).play(); |
360 break; | 352 break; |
361 } | 353 } |
362 } | 354 } |
363 | 355 |
364 public void run() | 356 public void run() |