New module: Platform - Split window management from Utility module (#128)
* New module: Platform - Split window management from Utility module Final touch * NDK/SDK: Bring back initialization of Utility
This commit is contained in:
committed by
Jérôme Leclercq
parent
41a1b5d493
commit
5aa072cee3
85
include/Nazara/Platform/EventHandler.inl
Normal file
85
include/Nazara/Platform/EventHandler.inl
Normal file
@@ -0,0 +1,85 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Platform module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Platform/EventHandler.hpp>
|
||||
#include <memory>
|
||||
#include <Nazara/Platform/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline EventHandler::EventHandler(const EventHandler& other) :
|
||||
HandledObject(other)
|
||||
{
|
||||
}
|
||||
|
||||
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/Platform/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user