Utility/Window: Add new event system, based on signals
Old pooling-based system remains for now but is now deprecated Former-commit-id: 9482b37fb19041399b7c26181319e1c00e7678fd [formerly 516aa322ca7f656e3e7c66010248b63068eec723] [formerly 6fdb81e8d59fef7d6e10e58898878d3e1a796188 [formerly c999fe23b149e14bdeeefed5436839fe44e1ebc3]] Former-commit-id: fb35c9017bc2c7d15e31ccadb3f943ca2f0332df [formerly 005fa120540dc1a2d09e30c2de9611c4cb98aecf] Former-commit-id: d51482384fffb5d1b339f3ce39df1a1ed6018228
This commit is contained in:
82
include/Nazara/Utility/EventHandler.inl
Normal file
82
include/Nazara/Utility/EventHandler.inl
Normal 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>
|
||||
Reference in New Issue
Block a user