Skip to content

Commit 171db8e

Browse files
committed
Merge branch 'sdl2' of github.com:q4a/xray-16 into sdl2
2 parents bd7e4dc + b1b6c26 commit 171db8e

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

src/Include/editor/engine.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class engine_base
2424
virtual void pause(bool const& value) = 0;
2525
virtual void capture_input(bool const& value) = 0;
2626
virtual void disconnect() = 0;
27+
virtual bool quit_requested() const = 0;
2728
// shared_str support
2829
virtual void value(LPCSTR value, shared_str& result) = 0;
2930
virtual LPCSTR value(shared_str const& value) = 0;

src/editors/xrWeatherEditor/entry_point.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private ref class window_ide_final : public editor::window_ide
5555
{
5656
m_engine->on_idle();
5757
impl->on_idle();
58-
} while (m_engine&&!PeekMessage(&message, HWND(0), 0, 0, 0));
58+
} while (m_engine && !m_engine->quit_requested() && !PeekMessage(&message, HWND(0), 0, 0, 0));
5959

6060
impl->on_idle_end();
6161
}

src/xrEngine/device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void CRenderDevice::End(void)
100100
if (g_pGamePersistent->GameType() == 1) // haCk
101101
{
102102
Uint32 flags = SDL_GetWindowFlags(m_sdlWnd);
103-
if (flags & SDL_WINDOW_INPUT_GRABBED)
103+
if (flags & SDL_WINDOW_INPUT_FOCUS)
104104
Pause(TRUE, TRUE, TRUE, "application start");
105105
}
106106
}

src/xrEngine/engine_impl.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ engine_impl::~engine_impl()
2525
capture_input(false);
2626
xr_delete(m_input_receiver);
2727
}
28-
void engine_impl::on_idle() { Device.on_idle(); }
28+
29+
void engine_impl::on_idle()
30+
{
31+
SDL_PumpEvents();
32+
Device.on_idle();
33+
}
2934
void engine_impl::on_resize()
3035
{
3136
if (Console)
@@ -54,6 +59,12 @@ void engine_impl::capture_input(bool const& value)
5459
}
5560

5661
void engine_impl::disconnect() { Console->Execute("quit"); }
62+
63+
bool engine_impl::quit_requested() const
64+
{
65+
return SDL_QuitRequested();
66+
}
67+
5768
void engine_impl::value(LPCSTR value, shared_str& result) { result = value; }
5869
LPCSTR engine_impl::value(shared_str const& value) { return (value.c_str()); }
5970
void engine_impl::weather(LPCSTR value)

src/xrEngine/engine_impl.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class engine_impl : public XRay::Editor::engine_base
2323
virtual void pause(bool const& value);
2424
virtual void capture_input(bool const& value);
2525
virtual void disconnect();
26+
bool quit_requested() const override;
2627

2728
virtual void value(LPCSTR value, shared_str& result);
2829
virtual LPCSTR value(shared_str const& value);

src/xrEngine/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ ENGINE_API void InitConsole()
110110

111111
ENGINE_API void InitInput()
112112
{
113-
bool captureInput = !strstr(Core.Params, "-i");
113+
bool captureInput = !strstr(Core.Params, "-i") && !GEnv.isEditor;
114114
pInput = new CInput(captureInput);
115115
}
116116

@@ -321,7 +321,7 @@ bool CheckBenchmark()
321321
const u32 sz = xr_strlen(sashName);
322322
string512 sashArg;
323323
sscanf(strstr(Core.Params, sashName) + sz, "%[^ ] ", sashArg);
324-
#if !defined(LOINUX)
324+
#if !defined(LINUX)
325325
g_SASH.Init(sashArg);
326326
g_SASH.MainLoop();
327327
#endif

0 commit comments

Comments
 (0)