aboutsummaryrefslogtreecommitdiff
path: root/test/01HelloWorld/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/01HelloWorld/main.cpp')
-rw-r--r--test/01HelloWorld/main.cpp47
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