diff options
author | chai <chaifix@163.com> | 2018-07-28 13:33:11 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-07-28 13:33:11 +0800 |
commit | 97c96e1d127a7a0c21d6bcf8af97b90649971d1f (patch) | |
tree | 4f227b09a47420ffc6ae89532cd49a90a416e327 /test/01HelloWorld/main.cpp | |
parent | ce63f79c7d683d0de398f6ea0483cdd59ec06a62 (diff) |
*update
Diffstat (limited to 'test/01HelloWorld/main.cpp')
-rw-r--r-- | test/01HelloWorld/main.cpp | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/test/01HelloWorld/main.cpp b/test/01HelloWorld/main.cpp index 701d53f..09a12d3 100644 --- a/test/01HelloWorld/main.cpp +++ b/test/01HelloWorld/main.cpp @@ -1,7 +1,48 @@ +#include <iostream> #include "jin.h" -int main() +using namespace jin::core; +using namespace jin::graphics; +using namespace jin::input; + +void onEvent(jin::input::Event* e) +{ + static Game* game = Game::get(); + if (e->type == EventType::QUIT) + game->stop(); +} + +void onUpdate(float dt) +{ + +} + +void onDraw() { - jin::core::Game* game; - jin::graphics::WindowSystem; + +} + +int main(int argc, char* argv[]) +{ + Game* game = Game::get(); + Game::Setting setting; + setting.eventHandler = onEvent; + setting.updater = onUpdate; + setting.drawer = onDraw; + game->init(&setting); + + WindowSystem* wnd = WindowSystem::get(); + WindowSystem::Setting wndSetting; + wndSetting.width = 600; + wndSetting.height = 512; + wndSetting.title = "test"; + wndSetting.vsync = false; + wnd->init(&wndSetting); + + game->run(); + + game->quit(); + wnd->quit(); + + return 0; }
\ No newline at end of file |