Former-commit-id: 45fb49cbc3b4a2390ee80811047eb644cc511356 [formerly 998ad04604d18cce89046d3d0407d28710bb8b76] [formerly 5374b51a3e533ece806584d6c299a39954024506 [formerly f658b4d5fc1fce17ce67c5c2082111a6cae6f176]] Former-commit-id: 42808b9eb7c267c608707505edaf4507d10798ab [formerly 8a37a4b8430f9fd59e6cd10db5d82b11651236b8] Former-commit-id: 128b4f8aa6ab1a3b7842d3b6c84168d1cb06ec31
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:
|
|
OnMouseButtonReleased(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>
|