From b23830f79fd742d4ca191ad7a34456d5a130bd61 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 27 Oct 2014 14:42:32 +0200 Subject: [PATCH] builtin/main_context: Create Urho3D stuff in init() --- builtin/main_context/main_context.cpp | 29 +++++++++------------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/builtin/main_context/main_context.cpp b/builtin/main_context/main_context.cpp index 2d7b0d1..2eabc48 100644 --- a/builtin/main_context/main_context.cpp +++ b/builtin/main_context/main_context.cpp @@ -86,23 +86,6 @@ struct Module: public interface::Module, public main_context::Interface m_server->sub_event(this, Event::t("core:unload")); m_server->sub_event(this, Event::t("core:continue")); m_server->sub_event(this, Event::t("core:tick")); - } - - void event(const Event::Type &type, const Event::Private *p) - { - EVENT_VOIDN("core:start", on_start) - EVENT_VOIDN("core:unload", on_unload) - EVENT_VOIDN("core:continue", on_continue) - EVENT_TYPEN("core:tick", on_tick, interface::TickEvent) - EVENT_TYPEN("urho3d_log_redirect:message", on_message, - interface::MagicEvent) - } - - void init_in_module_thread() - { - // Urho3D wants to know which is the main thread of the context. Module - // constructor and init() are called from a different thread than - // regular event(), so this is required. // Initialize Urho3D @@ -157,10 +140,19 @@ struct Module: public interface::Module, public main_context::Interface m_server->sub_event(this, Event::t("urho3d_log_redirect:message")); } + void event(const Event::Type &type, const Event::Private *p) + { + EVENT_VOIDN("core:start", on_start) + EVENT_VOIDN("core:unload", on_unload) + EVENT_VOIDN("core:continue", on_continue) + EVENT_TYPEN("core:tick", on_tick, interface::TickEvent) + EVENT_TYPEN("urho3d_log_redirect:message", on_message, + interface::MagicEvent) + } + void on_start() { log_v(MODULE, "main_context start"); - init_in_module_thread(); } void on_unload() @@ -171,7 +163,6 @@ struct Module: public interface::Module, public main_context::Interface void on_continue() { log_v(MODULE, "main_context continue"); - init_in_module_thread(); } void on_tick(const interface::TickEvent &event)