From fb7d8a25e2994cb3cdd5eccde1797f6e3a308f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20=E2=80=98Touky=E2=80=99=20Huet?= Date: Fri, 13 Sep 2013 10:33:16 +0000 Subject: [PATCH] btphystest tweak to delay app init. --- test/btphystest.cpp | 18 ++++++++++++++++++ test/btphystest.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/test/btphystest.cpp b/test/btphystest.cpp index 7c2d29f8..2a881ff6 100644 --- a/test/btphystest.cpp +++ b/test/btphystest.cpp @@ -59,6 +59,13 @@ LOLFX_RESOURCE_DECLARE(front_camera_sprite); BtPhysTest::BtPhysTest(bool editor) { + m_init_done = false; +} + +void BtPhysTest::InitApp() +{ + m_init_done = true; + m_loop_value = .0f; #if CAT_MODE @@ -298,6 +305,14 @@ void BtPhysTest::TickGame(float seconds) { WorldEntity::TickGame(seconds); + if (!m_init_done) + { + if (g_renderer) + InitApp(); + else + return; + } + if (m_controller->GetKey(KEY_QUIT).IsReleased()) Ticker::Shutdown(); @@ -550,6 +565,9 @@ void BtPhysTest::TickDraw(float seconds) { WorldEntity::TickDraw(seconds); + if (!m_init_done) + return; + if (!m_ready) { #if CAT_MODE diff --git a/test/btphystest.h b/test/btphystest.h index 414d7a78..773bf6f9 100644 --- a/test/btphystest.h +++ b/test/btphystest.h @@ -41,6 +41,8 @@ protected: virtual void TickGame(float seconds); virtual void TickDraw(float seconds); + void InitApp(); + private: enum { @@ -62,6 +64,7 @@ private: Controller * m_controller; Light * m_light1; Light * m_light2; + bool m_init_done; bool m_ready; lol::phys::Simulation* m_simulation;