Platform/Window: Make PushEvent public

This commit is contained in:
Lynix
2019-03-10 15:50:16 +01:00
parent 097d16f664
commit 23b2f0a48d
8 changed files with 118 additions and 28 deletions

View File

@@ -40,7 +40,7 @@ namespace Nz
inline Window(VideoMode mode, const String& title, WindowStyleFlags style = WindowStyle_Default);
inline explicit Window(WindowHandle handle);
Window(const Window&) = delete;
Window(Window&&) = default;
Window(Window&& window);
virtual ~Window();
inline void Close();
@@ -78,6 +78,8 @@ namespace Nz
NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system")
bool PollEvent(WindowEvent* event);
void PushEvent(const WindowEvent& event);
void ProcessEvents(bool block = false);
void SetCursor(CursorRef cursor);
@@ -101,7 +103,7 @@ namespace Nz
bool WaitEvent(WindowEvent* event);
Window& operator=(const Window&) = delete;
Window& operator=(Window&&) = default;
Window& operator=(Window&& window);
protected:
virtual bool OnWindowCreated();
@@ -111,13 +113,17 @@ namespace Nz
MovablePtr<WindowImpl> m_impl;
private:
void ConnectSlots();
void DisconnectSlots();
void IgnoreNextMouseEvent(int mouseX, int mouseY) const;
inline void HandleEvent(const WindowEvent& event);
inline void PushEvent(const WindowEvent& event);
void HandleEvent(const WindowEvent& event);
static bool Initialize();
static void Uninitialize();
NazaraSlot(CursorController, OnCursorUpdated, m_cursorUpdateSlot);
std::queue<WindowEvent> m_events;
std::vector<WindowEvent> m_pendingEvents;
ConditionVariable m_eventCondition;

View File

@@ -2,6 +2,7 @@
// This file is part of the "Nazara Engine - Platform module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Platform/Window.hpp>
#include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Core/LockGuard.hpp>
#include <Nazara/Platform/Debug.hpp>
@@ -90,20 +91,6 @@ namespace Nz
SetCursor(Cursor::Get(systemCursor));
}
inline void Window::HandleEvent(const WindowEvent& event)
{
if (m_eventPolling)
m_events.push(event);
m_eventHandler.Dispatch(event);
if (event.type == WindowEventType_Resized)
OnWindowResized();
if (event.type == WindowEventType_Quit && m_closeOnQuit)
Close();
}
inline void Window::PushEvent(const WindowEvent& event)
{
if (!m_asyncWindow)