From 5560448bb78ed865aeb77f62cf85a2aed302779d Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 29 Jul 2018 12:16:17 +0800 Subject: *update --- src/libjin/core/game.cpp | 2 ++ src/libjin/core/game.h | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/libjin/core') diff --git a/src/libjin/core/game.cpp b/src/libjin/core/game.cpp index ffd8015..929cc07 100644 --- a/src/libjin/core/game.cpp +++ b/src/libjin/core/game.cpp @@ -19,6 +19,7 @@ namespace core void Game::run() { + SAFECALL(_onLoad); Window* wnd = Window::get(); const int FPS = wnd ? wnd->getFPS() : 60; const int MS_PER_UPDATE = 1000.0f / FPS; @@ -59,6 +60,7 @@ namespace core _onEvent = s->eventHandler; _onUpdate = s->updater; _onDraw = s->drawer; + _onLoad = s->loader; return true; } diff --git a/src/libjin/core/game.h b/src/libjin/core/game.h index 090e7c6..9359487 100644 --- a/src/libjin/core/game.h +++ b/src/libjin/core/game.h @@ -16,6 +16,7 @@ namespace core { public: + typedef void(*onLoad)(); typedef void(*onEvent)(jin::input::Event* e); typedef void(*onUpdate)(float dt); typedef void(*onDraw)(); @@ -25,6 +26,7 @@ namespace core onEvent eventHandler; onUpdate updater; onDraw drawer; + onLoad loader; }; void run(); @@ -38,9 +40,10 @@ namespace core SINGLETON(Game); - onEvent _onEvent; + onEvent _onEvent; onUpdate _onUpdate; - onDraw _onDraw; + onDraw _onDraw; + onLoad _onLoad; bool _running; -- cgit v1.1-26-g67d0