Inferno Game Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
1.0 KiB

/*
* Copyright (C) 2022 Riyyi
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include <sstream> // std::stringstream
#include "inferno/event/event.h"
namespace Inferno {
class JoystickEvent : public Event {
public:
inline int getID() const { return m_id; }
EVENT_CLASS_CATEGORY(InputEventCategory | JoystickEventCatergory)
protected:
JoystickEvent(int id)
: m_id(id)
{
}
private:
int m_id;
};
class JoystickConnectedEvent : public JoystickEvent {
public:
JoystickConnectedEvent(int id)
: JoystickEvent(id)
{
}
virtual std::string toString() const override
{
std::stringstream ss;
ss << "JoystickConnected: " << getID();
return ss.str();
}
EVENT_CLASS_TYPE(JoystickConnected)
};
class JoystickDisconnectedEvent : public JoystickEvent {
public:
JoystickDisconnectedEvent(int id)
: JoystickEvent(id)
{
}
virtual std::string toString() const override
{
std::stringstream ss;
ss << "JoystickDisconnected: " << getID();
return ss.str();
}
EVENT_CLASS_TYPE(JoystickDisconnected)
};
} // namespace Inferno