Skip to content

Commit

Permalink
Merge branch 'sdl2' of github.com:q4a/xray-16 into sdl2
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Jul 28, 2018
2 parents bd7e4dc + b1b6c26 commit 171db8e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/Include/editor/engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,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
2 changes: 1 addition & 1 deletion src/xrEngine/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void CRenderDevice::End(void)
if (g_pGamePersistent->GameType() == 1) // haCk
{
Uint32 flags = SDL_GetWindowFlags(m_sdlWnd);
if (flags & SDL_WINDOW_INPUT_GRABBED)
if (flags & SDL_WINDOW_INPUT_FOCUS)
Pause(TRUE, TRUE, TRUE, "application start");
}
}
Expand Down
13 changes: 12 additions & 1 deletion src/xrEngine/engine_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ engine_impl::~engine_impl()
capture_input(false);
xr_delete(m_input_receiver);
}
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 @@ -54,6 +59,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 @@ -23,6 +23,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
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -321,7 +321,7 @@ bool CheckBenchmark()
const u32 sz = xr_strlen(sashName);
string512 sashArg;
sscanf(strstr(Core.Params, sashName) + sz, "%[^ ] ", sashArg);
#if !defined(LOINUX)
#if !defined(LINUX)
g_SASH.Init(sashArg);
g_SASH.MainLoop();
#endif
Expand Down

0 comments on commit 171db8e

Please sign in to comment.