Utility/Window: Add new event system, based on signals

Old pooling-based system remains for now but is now deprecated


Former-commit-id: d72e76bab0887baa03286aed78f7ded0a2e31928 [formerly ec70c388b12fb2b91017e54f4a6d67bac1c62335] [formerly 1a6692f78aedb5328b223c04c566d32467db6c92 [formerly 64b8d386ff07df682760ec632d753545ecff7856]]
Former-commit-id: aba6a64e2a31336ae1835bc9954d22488fda2000 [formerly a42eceabc84044a258926385db3944ada398f4fa]
Former-commit-id: 07a208c5693749b325e8574b52e7affa298bb147
This commit is contained in:
Lynix
2016-08-28 01:08:38 +02:00
parent 5528b26a25
commit 9fa65db6b9
7 changed files with 181 additions and 38 deletions

View File

@@ -14,7 +14,7 @@
#include <Nazara/Math/Vector2.hpp>
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/Event.hpp>
#include <Nazara/Utility/EventHandler.hpp>
#include <Nazara/Utility/VideoMode.hpp>
#include <Nazara/Utility/WindowHandle.hpp>
#include <queue>
@@ -52,9 +52,11 @@ namespace Nz
void Destroy();
NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system") inline void EnableEventPolling(bool enable);
void EnableKeyRepeat(bool enable);
void EnableSmoothScrolling(bool enable);
EventHandler& GetEventHandler();
WindowHandle GetHandle() const;
unsigned int GetHeight() const;
Vector2i GetPosition() const;
@@ -71,7 +73,9 @@ namespace Nz
inline bool IsValid() const;
bool IsVisible() const;
bool PollEvent(WindowEvent* event);
NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system") bool PollEvent(WindowEvent* event);
void ProcessEvents(bool block = false);
void SetCursor(WindowCursor cursor);
void SetCursor(const Cursor& cursor);
@@ -90,7 +94,7 @@ namespace Nz
void SetTitle(const String& title);
void SetVisible(bool visible);
bool WaitEvent(WindowEvent* event);
NAZARA_DEPRECATED("Event pooling/waiting is deprecated, please use the EventHandler system")bool WaitEvent(WindowEvent* event);
Window& operator=(const Window&) = delete;
inline Window& operator=(Window&& window);
@@ -114,10 +118,11 @@ namespace Nz
ConditionVariable m_eventCondition;
Mutex m_eventMutex;
Mutex m_eventConditionMutex;
bool m_eventListener;
bool m_waitForEvent;
#endif
EventHandler m_eventHandler;
bool m_closed;
bool m_eventPolling;
bool m_ownsWindow;
};
}