System/MessageQueue: Use PlatformEventQueue
This commit is contained in:
parent
e6718e7ef1
commit
fb58490bfe
3 changed files with 31 additions and 0 deletions
|
|
@ -1,8 +1,26 @@
|
|||
|
||||
#include <Spectre/System/MessageQueue.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Platform/Win32/Win32EventQueue.h>
|
||||
typedef sp::Win32EventQueue ImplType;
|
||||
#else
|
||||
#error "No MessageQueue implementation exists"
|
||||
#endif
|
||||
|
||||
|
||||
namespace sp {
|
||||
|
||||
MessageQueue::MessageQueue()
|
||||
{
|
||||
m_impl = new ImplType();
|
||||
}
|
||||
|
||||
MessageQueue::~MessageQueue()
|
||||
{
|
||||
delete m_impl;
|
||||
}
|
||||
|
||||
void MessageQueue::postEvent(SysEvent event)
|
||||
{
|
||||
m_queue.push_back(event);
|
||||
|
|
@ -10,6 +28,11 @@ void MessageQueue::postEvent(SysEvent event)
|
|||
|
||||
bool MessageQueue::pollEvent(SysEvent& event)
|
||||
{
|
||||
// Process platform events first.
|
||||
if (m_impl->poll(event)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isEmpty()) {
|
||||
event = m_queue.front();
|
||||
m_queue.pop_front();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue