1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
/***************************************************************************
Simple test. A cube should be visible in the middle of the screen.
The arrow keys rotates the cube.
***************************************************************************/
#include <iostream>
#include "Private.h"
#include "Engine.h"
#include "Camera.h"
#include "Cube.h"
#include "KeyRotBehavior.h"
#include "Keyboard.h"
#include "SoundUtil.h"
/** Main */
int main(int argc, char *argv[]) {
cerr << "Sound test." << endl;
if (argc < 3) {
cerr << "Usage: sound <file.wav> <file.mid>" << endl;
return -1;
}
// Create the engine.
Engine* engine = new Engine(argc, argv);
if (argc < 3) {
cerr << "Usage: sound <file.wav> <file.mid>" << endl;
return -1;
}
int sound = SoundUtil::getInstance()->loadSample(argv[1]);
if (sound < 0) {
cerr << "Sound not loaded" << endl;
return -1;
}
int music = SoundUtil::getInstance()->loadMusic(argv[2]);
if (music < 0) {
cerr << "Sound not loaded" << endl;
return -1;
}
SoundUtil::getInstance()->playMusic(music, true);
while (!Keyboard::isKeyDown(SDLK_ESCAPE)) {
if (Keyboard::isKeyDown(SDLK_SPACE)) {
SoundUtil::getInstance()->playSample(sound, false);
}
engine->tick();
engine->delay(20);
}
//delete(engine);
return 0;
}
#if EM_USE_ALLEGRO
END_OF_MAIN();
#endif
|