|
|
|
@ -16,8 +16,9 @@ namespace vr {
|
|
|
|
|
|
|
|
|
|
// A result of getting rid of the union and extracting
|
|
|
|
|
// event types into individual classes is the fact that
|
|
|
|
|
// there is going to be a lot of repeat code i.e the
|
|
|
|
|
// difference between KeyPressed and KeyReleased
|
|
|
|
|
// there is going to be a lot of repeat code i.e
|
|
|
|
|
// KeyPressed, KeyHeld, and KeyReleased all hold the same
|
|
|
|
|
// data, it's just their names that are different
|
|
|
|
|
|
|
|
|
|
class Event {
|
|
|
|
|
public:
|
|
|
|
@ -30,15 +31,18 @@ namespace vr {
|
|
|
|
|
GainedFocus,
|
|
|
|
|
TextEntered,
|
|
|
|
|
KeyPressed,
|
|
|
|
|
KeyHeld,
|
|
|
|
|
KeyReleased,
|
|
|
|
|
MouseWheelMoved,
|
|
|
|
|
MouseWheelScrolled,
|
|
|
|
|
MouseButtonPressed,
|
|
|
|
|
MouseButtonHeld,
|
|
|
|
|
MouseButtonReleased,
|
|
|
|
|
MouseMoved,
|
|
|
|
|
MouseEntered,
|
|
|
|
|
MouseLeft,
|
|
|
|
|
JoystickButtonPressed,
|
|
|
|
|
JoystickButtonHeld,
|
|
|
|
|
JoystickButtonReleased,
|
|
|
|
|
JoystickMoved,
|
|
|
|
|
JoystickConnected,
|
|
|
|
@ -48,6 +52,7 @@ namespace vr {
|
|
|
|
|
TouchEnded,
|
|
|
|
|
SensorChanged,
|
|
|
|
|
NetworkJoystickButtonPressed,
|
|
|
|
|
NetworkJoystickButtonHeld,
|
|
|
|
|
NetworkJoystickButtonReleased,
|
|
|
|
|
NetworkJoystickMoved,
|
|
|
|
|
NetworkJoystickConnected,
|
|
|
|
@ -105,6 +110,18 @@ namespace vr {
|
|
|
|
|
bool system;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class KeyHeld : public Event {
|
|
|
|
|
public:
|
|
|
|
|
KeyHeld(sf::Keyboard::Key code, bool alt, bool control, bool shift, bool system) :
|
|
|
|
|
code(code), alt(alt), control(control), shift(shift), system(system), Event(vr::Event::EventType::KeyHeld) {};
|
|
|
|
|
|
|
|
|
|
sf::Keyboard::Key code;
|
|
|
|
|
bool alt;
|
|
|
|
|
bool control;
|
|
|
|
|
bool shift;
|
|
|
|
|
bool system;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class KeyReleased : public Event {
|
|
|
|
|
public:
|
|
|
|
|
KeyReleased(sf::Keyboard::Key code, bool alt, bool control, bool shift, bool system) :
|
|
|
|
@ -144,6 +161,16 @@ namespace vr {
|
|
|
|
|
int y;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MouseButtonHeld : public Event {
|
|
|
|
|
public:
|
|
|
|
|
MouseButtonHeld(sf::Mouse::Button button, int x, int y) :
|
|
|
|
|
button(button), x(x), y(y), Event(vr::Event::EventType::MouseButtonHeld) {};
|
|
|
|
|
|
|
|
|
|
sf::Mouse::Button button;
|
|
|
|
|
int x;
|
|
|
|
|
int y;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MouseButtonReleased : public Event {
|
|
|
|
|
public:
|
|
|
|
|
MouseButtonReleased(sf::Mouse::Button button, int x, int y) :
|
|
|
|
@ -190,6 +217,15 @@ namespace vr {
|
|
|
|
|
unsigned int button;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class JoystickButtonHeld : public Event {
|
|
|
|
|
public:
|
|
|
|
|
JoystickButtonHeld(unsigned int joystickId, unsigned int button) :
|
|
|
|
|
joystickId(joystickId), button(button), Event(vr::Event::EventType::JoystickButtonHeld) {};
|
|
|
|
|
|
|
|
|
|
unsigned int joystickId;
|
|
|
|
|
unsigned int button;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class JoystickButtonReleased : public Event {
|
|
|
|
|
public:
|
|
|
|
|
JoystickButtonReleased(unsigned int joystickId, unsigned int button) :
|
|
|
|
@ -280,6 +316,15 @@ namespace vr {
|
|
|
|
|
unsigned int button;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetworkJoystickButtonHeld : public Event {
|
|
|
|
|
public:
|
|
|
|
|
NetworkJoystickButtonHeld(unsigned int joystickId, unsigned int button) :
|
|
|
|
|
joystickId(joystickId), button(button), Event(vr::Event::EventType::NetworkJoystickButtonHeld) {};
|
|
|
|
|
|
|
|
|
|
unsigned int joystickId;
|
|
|
|
|
unsigned int button;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class NetworkJoystickButtonReleased : public Event {
|
|
|
|
|
public:
|
|
|
|
|
NetworkJoystickButtonReleased(unsigned int joystickId, unsigned int button) :
|
|
|
|
|