Skip to content

Commit

Permalink
Fixed quitting from xrWeatherEditor
Browse files Browse the repository at this point in the history
Call SDL_PumpEvents() in on_idle() just in case
  • Loading branch information
Xottab-DUTY committed Jul 28, 2018
1 parent afc05bd commit c24a01d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Include/editor/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class engine_base
virtual void pause(bool const& value) = 0;
virtual void capture_input(bool const& value) = 0;
virtual void disconnect() = 0;
virtual bool quit_requested() const = 0;
// shared_str support
virtual void value(LPCSTR value, shared_str& result) = 0;
virtual LPCSTR value(shared_str const& value) = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/editors/xrWeatherEditor/entry_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private ref class window_ide_final : public editor::window_ide
{
m_engine->on_idle();
impl->on_idle();
} while (m_engine&&!PeekMessage(&message, HWND(0), 0, 0, 0));
} while (m_engine && !m_engine->quit_requested() && !PeekMessage(&message, HWND(0), 0, 0, 0));

impl->on_idle_end();
}
Expand Down
12 changes: 11 additions & 1 deletion src/xrEngine/engine_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ bool engine_impl::on_message(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
return (Device.on_message(hWnd, uMsg, wParam, lParam, result));
}

void engine_impl::on_idle() { Device.on_idle(); }
void engine_impl::on_idle()
{
SDL_PumpEvents();
Device.on_idle();
}
void engine_impl::on_resize()
{
if (Console)
Expand Down Expand Up @@ -60,6 +64,12 @@ void engine_impl::capture_input(bool const& value)
}

void engine_impl::disconnect() { Console->Execute("quit"); }

bool engine_impl::quit_requested() const
{
return SDL_QuitRequested();
}

void engine_impl::value(LPCSTR value, shared_str& result) { result = value; }
LPCSTR engine_impl::value(shared_str const& value) { return (value.c_str()); }
void engine_impl::weather(LPCSTR value)
Expand Down
1 change: 1 addition & 0 deletions src/xrEngine/engine_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class engine_impl : public XRay::Editor::engine_base
virtual void pause(bool const& value);
virtual void capture_input(bool const& value);
virtual void disconnect();
bool quit_requested() const override;

virtual void value(LPCSTR value, shared_str& result);
virtual LPCSTR value(shared_str const& value);
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ ENGINE_API void InitConsole()

ENGINE_API void InitInput()
{
bool captureInput = !strstr(Core.Params, "-i");
bool captureInput = !strstr(Core.Params, "-i") && !GEnv.isEditor;
pInput = new CInput(captureInput);
}

Expand Down

0 comments on commit c24a01d

Please sign in to comment.