diff options
author | chai <chaifix@163.com> | 2018-08-08 23:24:00 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-08-08 23:24:00 +0800 |
commit | 847e5910abcc2431ad284ef843d482807349682d (patch) | |
tree | 41deb02688a59cf14241dbcd0d732df9783502fa /test/02Audio/audiotest.cpp | |
parent | 4afb418bf779400005f5452776ec5e4df1d2eda6 (diff) | |
parent | 1019479c017bc42fa48bb5e825d26b5f70b00787 (diff) |
Merge branch 'master' of warmcat.org:/home/git-repo/libjin
Diffstat (limited to 'test/02Audio/audiotest.cpp')
-rw-r--r-- | test/02Audio/audiotest.cpp | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/test/02Audio/audiotest.cpp b/test/02Audio/audiotest.cpp deleted file mode 100644 index 4576cfa..0000000 --- a/test/02Audio/audiotest.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include <iostream> -#include "jin.h" - -using namespace jin::core; -using namespace jin::graphics; -using namespace jin::input; -using namespace jin::audio; - -void onEvent(jin::input::Event* e) -{ - static Game* game = Game::get(); - if (e->type == EventType::QUIT) - game->stop(); -} - -void onUpdate(int ms) -{ - -} - -void onDraw() -{ - -} - -int main(int argc, char* argv[]) -{ - Game* game = Game::get(); - Game::Setting setting; - setting.eventHandler = onEvent; - setting.updater = onUpdate; - setting.drawer = onDraw; - setting.loader = nullptr; - game->init(&setting); - - Window* wnd = Window::get(); - Window::Setting wndSetting; - wndSetting.width = 600; - wndSetting.height = 512; - wndSetting.title = "test"; - wndSetting.fps = 60; - wndSetting.vsync = false; - wndSetting.fullscreen = false; - wndSetting.resizable = false; - wnd->init(&wndSetting); - - SDLAudio* audio = SDLAudio::get(); - SDLAudio::Setting audioSetting; - audioSetting.samplerate = 44100; - audioSetting.samples = 44100; - audio->init(&audioSetting); - - SDLSource* src = SDLSource::createSource("a.ogg"); - src->play(); - src->setLoop(false); - - SDLSource* src2 = SDLSource::createSource("a.wav"); - src2->setLoop(true); - src2->play(); - - audio->setVolume(0.7); - - game->run(); - - game->quit(); - audio->quit(); - wnd->quit(); - - return 0; -}
\ No newline at end of file |