comparison game/Engine.java @ 93:e1d657e6c25b

Work on audio code.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 03 Mar 2011 18:21:45 +0200
parents 753156d64493
children 75015dfd47ef
comparison
equal deleted inserted replaced
92:d5f51370617b 93:e1d657e6c25b
213 public GameBoard(IDMPoint pos, float ps) 213 public GameBoard(IDMPoint pos, float ps)
214 { 214 {
215 super(pos); 215 super(pos);
216 pscale = ps; 216 pscale = ps;
217 217
218 // sndPlaced = smgr.getSound("sounds/placed.wav"); 218 sndPlaced = G.smgr.getSound("sounds/placed.wav");
219 219
220 startNewGame(); 220 startNewGame();
221 } 221 }
222 222
223 public void startNewGame() 223 public void startNewGame()
469 { 469 {
470 // Initialize globals 470 // Initialize globals
471 System.out.print("Engine() constructor\n"); 471 System.out.print("Engine() constructor\n");
472 472
473 // Sound system 473 // Sound system
474 G.smgr = new SoundManager(new AudioFormat(22050, 16, 1, true, false), 4); 474 G.smgr = new SoundManager(new AudioFormat(22050, 16, 1, true, false), 2);
475 475
476 // Load resources 476 // Load resources
477 try 477 try
478 { 478 {
479 ResourceLoader res = new ResourceLoader("graphics/board.jpg"); 479 ResourceLoader res = new ResourceLoader("graphics/board.jpg");
526 // Initialize event listeners 526 // Initialize event listeners
527 addKeyListener(this); 527 addKeyListener(this);
528 addMouseListener(this); 528 addMouseListener(this);
529 addMouseWheelListener(this); 529 addMouseWheelListener(this);
530 530
531 // Start playing background music
532 G.smgr.play(musa);
533
531 // Get initial focus 534 // Get initial focus
532 if (!hasFocus()) 535 if (!hasFocus())
533 { 536 {
534 System.out.print("Engine(): requesting focus\n"); 537 System.out.print("Engine(): requesting focus\n");
535 requestFocus(); 538 requestFocus();
536 } 539 }
537 540
538 // G.smgr.play(musa);
539 } 541 }
540 542
541 public void startNewGame() 543 public void startNewGame()
542 { 544 {
543 gameClock = 0; 545 gameClock = 0;