|
|
@ -16,8 +16,9 @@ namespace vr {
|
|
|
|
|
|
|
|
|
|
|
|
// A result of getting rid of the union and extracting
|
|
|
|
// A result of getting rid of the union and extracting
|
|
|
|
// event types into individual classes is the fact that
|
|
|
|
// event types into individual classes is the fact that
|
|
|
|
// there is going to be a lot of repeat code i.e the
|
|
|
|
// there is going to be a lot of repeat code i.e
|
|
|
|
// difference between KeyPressed and KeyReleased
|
|
|
|
// KeyPressed, KeyHeld, and KeyReleased all hold the same
|
|
|
|
|
|
|
|
// data, it's just their names that are different
|
|
|
|
|
|
|
|
|
|
|
|
class Event {
|
|
|
|
class Event {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
@ -30,15 +31,18 @@ namespace vr {
|
|
|
|
GainedFocus,
|
|
|
|
GainedFocus,
|
|
|
|
TextEntered,
|
|
|
|
TextEntered,
|
|
|
|
KeyPressed,
|
|
|
|
KeyPressed,
|
|
|
|
|
|
|
|
KeyHeld,
|
|
|
|
KeyReleased,
|
|
|
|
KeyReleased,
|
|
|
|
MouseWheelMoved,
|
|
|
|
MouseWheelMoved,
|
|
|
|
MouseWheelScrolled,
|
|
|
|
MouseWheelScrolled,
|
|
|
|
MouseButtonPressed,
|
|
|
|
MouseButtonPressed,
|
|
|
|
|
|
|
|
MouseButtonHeld,
|
|
|
|
MouseButtonReleased,
|
|
|
|
MouseButtonReleased,
|
|
|
|
MouseMoved,
|
|
|
|
MouseMoved,
|
|
|
|
MouseEntered,
|
|
|
|
MouseEntered,
|
|
|
|
MouseLeft,
|
|
|
|
MouseLeft,
|
|
|
|
JoystickButtonPressed,
|
|
|
|
JoystickButtonPressed,
|
|
|
|
|
|
|
|
JoystickButtonHeld,
|
|
|
|
JoystickButtonReleased,
|
|
|
|
JoystickButtonReleased,
|
|
|
|
JoystickMoved,
|
|
|
|
JoystickMoved,
|
|
|
|
JoystickConnected,
|
|
|
|
JoystickConnected,
|
|
|
@ -48,6 +52,7 @@ namespace vr {
|
|
|
|
TouchEnded,
|
|
|
|
TouchEnded,
|
|
|
|
SensorChanged,
|
|
|
|
SensorChanged,
|
|
|
|
NetworkJoystickButtonPressed,
|
|
|
|
NetworkJoystickButtonPressed,
|
|
|
|
|
|
|
|
NetworkJoystickButtonHeld,
|
|
|
|
NetworkJoystickButtonReleased,
|
|
|
|
NetworkJoystickButtonReleased,
|
|
|
|
NetworkJoystickMoved,
|
|
|
|
NetworkJoystickMoved,
|
|
|
|
NetworkJoystickConnected,
|
|
|
|
NetworkJoystickConnected,
|
|
|
@ -72,8 +77,8 @@ namespace vr {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
Resized(unsigned int width, unsigned int height) :
|
|
|
|
Resized(unsigned int width, unsigned int height) :
|
|
|
|
width(width), height(height), Event(vr::Event::EventType::Resized) {};
|
|
|
|
width(width), height(height), Event(vr::Event::EventType::Resized) {};
|
|
|
|
unsigned int width;
|
|
|
|
unsigned int width;
|
|
|
|
unsigned int height;
|
|
|
|
unsigned int height;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class LostFocus : public Event {
|
|
|
|
class LostFocus : public Event {
|
|
|
@ -105,6 +110,18 @@ namespace vr {
|
|
|
|
bool system;
|
|
|
|
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 {
|
|
|
|
class KeyReleased : public Event {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
KeyReleased(sf::Keyboard::Key code, bool alt, bool control, bool shift, bool system) :
|
|
|
|
KeyReleased(sf::Keyboard::Key code, bool alt, bool control, bool shift, bool system) :
|
|
|
@ -144,6 +161,16 @@ namespace vr {
|
|
|
|
int y;
|
|
|
|
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 {
|
|
|
|
class MouseButtonReleased : public Event {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
MouseButtonReleased(sf::Mouse::Button button, int x, int y) :
|
|
|
|
MouseButtonReleased(sf::Mouse::Button button, int x, int y) :
|
|
|
@ -159,8 +186,8 @@ namespace vr {
|
|
|
|
MouseMoved(int x, int y) :
|
|
|
|
MouseMoved(int x, int y) :
|
|
|
|
x(x), y(y), Event(vr::Event::EventType::MouseMoved) {};
|
|
|
|
x(x), y(y), Event(vr::Event::EventType::MouseMoved) {};
|
|
|
|
|
|
|
|
|
|
|
|
int x;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class MouseEntered : public Event {
|
|
|
|
class MouseEntered : public Event {
|
|
|
@ -168,8 +195,8 @@ namespace vr {
|
|
|
|
MouseEntered(int x, int y) :
|
|
|
|
MouseEntered(int x, int y) :
|
|
|
|
x(x), y(y), Event(vr::Event::EventType::MouseEntered) {};
|
|
|
|
x(x), y(y), Event(vr::Event::EventType::MouseEntered) {};
|
|
|
|
|
|
|
|
|
|
|
|
int x;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class MouseLeft : public Event {
|
|
|
|
class MouseLeft : public Event {
|
|
|
@ -177,8 +204,8 @@ namespace vr {
|
|
|
|
MouseLeft(int x, int y) :
|
|
|
|
MouseLeft(int x, int y) :
|
|
|
|
x(x), y(y), Event(vr::Event::EventType::MouseLeft) {};
|
|
|
|
x(x), y(y), Event(vr::Event::EventType::MouseLeft) {};
|
|
|
|
|
|
|
|
|
|
|
|
int x;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class JoystickButtonPressed : public Event {
|
|
|
|
class JoystickButtonPressed : public Event {
|
|
|
@ -186,8 +213,17 @@ namespace vr {
|
|
|
|
JoystickButtonPressed(unsigned int joystickId, unsigned int button) :
|
|
|
|
JoystickButtonPressed(unsigned int joystickId, unsigned int button) :
|
|
|
|
joystickId(joystickId), button(button), Event(vr::Event::EventType::JoystickButtonPressed) {};
|
|
|
|
joystickId(joystickId), button(button), Event(vr::Event::EventType::JoystickButtonPressed) {};
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int joystickId;
|
|
|
|
unsigned int joystickId;
|
|
|
|
unsigned int button;
|
|
|
|
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 {
|
|
|
|
class JoystickButtonReleased : public Event {
|
|
|
@ -195,8 +231,8 @@ namespace vr {
|
|
|
|
JoystickButtonReleased(unsigned int joystickId, unsigned int button) :
|
|
|
|
JoystickButtonReleased(unsigned int joystickId, unsigned int button) :
|
|
|
|
joystickId(joystickId), button(button), Event(vr::Event::EventType::JoystickButtonReleased) {};
|
|
|
|
joystickId(joystickId), button(button), Event(vr::Event::EventType::JoystickButtonReleased) {};
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int joystickId;
|
|
|
|
unsigned int joystickId;
|
|
|
|
unsigned int button;
|
|
|
|
unsigned int button;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class JoystickMoved : public Event {
|
|
|
|
class JoystickMoved : public Event {
|
|
|
@ -214,7 +250,7 @@ namespace vr {
|
|
|
|
JoystickConnected(unsigned int joystickId) :
|
|
|
|
JoystickConnected(unsigned int joystickId) :
|
|
|
|
joystickId(joystickId), Event(vr::Event::EventType::JoystickConnected) {};
|
|
|
|
joystickId(joystickId), Event(vr::Event::EventType::JoystickConnected) {};
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int joystickId;
|
|
|
|
unsigned int joystickId;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class JoystickDisconnected : public Event {
|
|
|
|
class JoystickDisconnected : public Event {
|
|
|
@ -222,7 +258,7 @@ namespace vr {
|
|
|
|
JoystickDisconnected(unsigned int joystickId) :
|
|
|
|
JoystickDisconnected(unsigned int joystickId) :
|
|
|
|
joystickId(joystickId), Event(vr::Event::EventType::JoystickDisconnected) {};
|
|
|
|
joystickId(joystickId), Event(vr::Event::EventType::JoystickDisconnected) {};
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int joystickId;
|
|
|
|
unsigned int joystickId;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class TouchBegan : public Event {
|
|
|
|
class TouchBegan : public Event {
|
|
|
@ -230,9 +266,9 @@ namespace vr {
|
|
|
|
TouchBegan(unsigned int finger, int x, int y) :
|
|
|
|
TouchBegan(unsigned int finger, int x, int y) :
|
|
|
|
finger(finger), x(x), y(y), Event(vr::Event::EventType::TouchBegan) {};
|
|
|
|
finger(finger), x(x), y(y), Event(vr::Event::EventType::TouchBegan) {};
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int finger;
|
|
|
|
unsigned int finger;
|
|
|
|
int x;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class TouchMoved : public Event {
|
|
|
|
class TouchMoved : public Event {
|
|
|
@ -240,9 +276,9 @@ namespace vr {
|
|
|
|
TouchMoved(unsigned int finger, int x, int y) :
|
|
|
|
TouchMoved(unsigned int finger, int x, int y) :
|
|
|
|
finger(finger), x(x), y(y), Event(vr::Event::EventType::TouchMoved) {};
|
|
|
|
finger(finger), x(x), y(y), Event(vr::Event::EventType::TouchMoved) {};
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int finger;
|
|
|
|
unsigned int finger;
|
|
|
|
int x;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class TouchEnded : public Event {
|
|
|
|
class TouchEnded : public Event {
|
|
|
@ -250,9 +286,9 @@ namespace vr {
|
|
|
|
TouchEnded(unsigned int finger, int x, int y) :
|
|
|
|
TouchEnded(unsigned int finger, int x, int y) :
|
|
|
|
finger(finger), x(x), y(y), Event(vr::Event::EventType::TouchEnded) {};
|
|
|
|
finger(finger), x(x), y(y), Event(vr::Event::EventType::TouchEnded) {};
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int finger;
|
|
|
|
unsigned int finger;
|
|
|
|
int x;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class SensorChanged : public Event {
|
|
|
|
class SensorChanged : public Event {
|
|
|
@ -260,10 +296,10 @@ namespace vr {
|
|
|
|
SensorChanged(sf::Sensor::Type type, float x, float y, float z) :
|
|
|
|
SensorChanged(sf::Sensor::Type type, float x, float y, float z) :
|
|
|
|
type(type), x(x), y(y), z(z), Event(vr::Event::EventType::SensorChanged) {};
|
|
|
|
type(type), x(x), y(y), z(z), Event(vr::Event::EventType::SensorChanged) {};
|
|
|
|
|
|
|
|
|
|
|
|
sf::Sensor::Type type;
|
|
|
|
sf::Sensor::Type type;
|
|
|
|
float x;
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
float y;
|
|
|
|
float z;
|
|
|
|
float z;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// I'm moving this to it's own event type because
|
|
|
|
// I'm moving this to it's own event type because
|
|
|
@ -280,6 +316,15 @@ namespace vr {
|
|
|
|
unsigned int button;
|
|
|
|
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 {
|
|
|
|
class NetworkJoystickButtonReleased : public Event {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
NetworkJoystickButtonReleased(unsigned int joystickId, unsigned int button) :
|
|
|
|
NetworkJoystickButtonReleased(unsigned int joystickId, unsigned int button) :
|
|
|
|