Riyyi
5 years ago
2 changed files with 60 additions and 0 deletions
@ -0,0 +1,55 @@
|
||||
#ifndef JOYSTICKEVENT_H |
||||
#define JOYSTICKEVENT_H |
||||
|
||||
#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) |
||||
}; |
||||
|
||||
} |
||||
|
||||
|
||||
#endif // JOYSTICKEVENT_H
|
Loading…
Reference in new issue