Former-commit-id: 2e598906e684b4328d99a9226ce03c90ad2573ad [formerly 653efe0750defdec35c094fa8ec72cb3b35a1ca0] [formerly d4fe9970a38bc851114697a315a561199dd4f146 [formerly 909526b7566949bf50375a90ef44264425b06f0e]] Former-commit-id: d8ef7a871bd700761eb87404131d11e5bb0bd324 [formerly 9e23fe05aeb8b4e042d0583960afa5ca8b2ce6ec] Former-commit-id: 5e8dacdd4f0323551f5ae2ae83f7841f5c7ac479
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>
|