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

@@ -0,0 +1,82 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/EventHandler.hpp>
#include <memory>
#include <Nazara/Utility/Debug.hpp>
namespace Nz
{
inline EventHandler::EventHandler(const EventHandler&)
{
}
inline void EventHandler::Dispatch(const WindowEvent& event)
{
switch (event.type)
{
case WindowEventType_GainedFocus:
OnGainedFocus(this);
break;
case WindowEventType_KeyPressed:
OnKeyPressed(this, event.key);
break;
case WindowEventType_KeyReleased:
OnKeyReleased(this, event.key);
break;
case WindowEventType_LostFocus:
OnLostFocus(this);
break;
case WindowEventType_MouseButtonDoubleClicked:
OnMouseButtonDoubleClicked(this, event.mouseButton);
break;
case WindowEventType_MouseButtonPressed:
OnMouseButtonPressed(this, event.mouseButton);
break;
case WindowEventType_MouseButtonReleased:
OnMouseButtonPressed(this, event.mouseButton);
break;
case WindowEventType_MouseEntered:
OnMouseEntered(this);
break;
case WindowEventType_MouseLeft:
OnMouseLeft(this);
break;
case WindowEventType_MouseMoved:
OnMouseMoved(this, event.mouseMove);
break;
case WindowEventType_MouseWheelMoved:
OnMouseWheelMoved(this, event.mouseWheel);
break;
case WindowEventType_Moved:
OnMoved(this, event.position);
break;
case WindowEventType_Quit:
OnQuit(this);
break;
case WindowEventType_Resized:
OnResized(this, event.size);
break;
case WindowEventType_TextEntered:
OnTextEntered(this, event.text);
break;
}
}
}
#include <Nazara/Utility/DebugOff.hpp>