Former-commit-id: cbbd3b12bd39eb5864d36b4e65170537dd3ca556 [formerly 80427bae4f2fef2233e41b85deaeba918e255093] [formerly 214fdf978a17f2d0aaa322f5d2258dbc8e7e2165 [formerly 141936940313f2f7ab16ab40e9ef0b02d3774b35]] Former-commit-id: 16629755c17ea100d6baacf9ebf8ebf34d8010a6 [formerly 26d4be9f6128fa9eb1546f7b57cada10b7c2a0f1] Former-commit-id: 019fbb16bcc12f9bd9644eb14aa8a4743618746e
85 lines
1.8 KiB
C++
85 lines
1.8 KiB
C++
// 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)
|
|
{
|
|
OnEvent(this, 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>
|