Former-commit-id: c4f6d185d78db4d9fa0e0ca76cf7b42768cd2ed3 [formerly 62df0f1948485951d72c42a51b511ecc5b283278] [formerly 444726d074e7e939db81547bf2f3dbcdc9eb25f6 [formerly 38d61f87a4280a20ac94286481dd418d5d931989]] Former-commit-id: 5a075b3e46f01486271fe5157b7176e768d8f939 [formerly bde57734c06d9d0b8220b65348cf8a67f971e228] Former-commit-id: 5e0857da1061965a4f8d9cf1c181ed25bf511320
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>
|