WindowEvents
This commit is contained in:
209
include/utils/Window/WindowEvents.h
Normal file
209
include/utils/Window/WindowEvents.h
Normal file
@@ -0,0 +1,209 @@
|
||||
#ifndef WINDOWEVENTS_H
|
||||
#define WINDOWEVENTS_H
|
||||
|
||||
#include "utils/Events/Event.h"
|
||||
|
||||
//implimentation independent events
|
||||
|
||||
namespace Archimedes {
|
||||
|
||||
class Window;
|
||||
|
||||
struct WindowData {
|
||||
Window* window;
|
||||
std::list<Event*> eventList;
|
||||
std::function<void(Event*)> sendEvent;
|
||||
};
|
||||
|
||||
class WindowResizeEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowResizeEvent() : width(0), height(0) {}
|
||||
|
||||
WindowResizeEvent(int w, int h) : width(w), height(h) {}
|
||||
|
||||
~WindowResizeEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowResizeEvent"; }
|
||||
|
||||
int width, height;
|
||||
|
||||
};
|
||||
|
||||
class WindowCloseEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowCloseEvent() : window(nullptr) {}
|
||||
|
||||
WindowCloseEvent(const Window* w) : window(w) {}
|
||||
|
||||
~WindowCloseEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowCloseEvent"; }
|
||||
|
||||
const Window* window;
|
||||
};
|
||||
|
||||
class WindowKeyPressedEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowKeyPressedEvent() : key(0), repeat(0) {}
|
||||
|
||||
WindowKeyPressedEvent(unsigned int k, unsigned int r) : key(k), repeat(r) {}
|
||||
|
||||
~WindowKeyPressedEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowKeyPressedEvent"; }
|
||||
|
||||
unsigned int key;
|
||||
unsigned int repeat;
|
||||
};
|
||||
|
||||
class WindowKeyReleasedEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowKeyReleasedEvent() : key(0) {}
|
||||
|
||||
WindowKeyReleasedEvent(unsigned int k) : key(k) {}
|
||||
|
||||
~WindowKeyReleasedEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowKeyReleasedEvent"; }
|
||||
|
||||
unsigned int key;
|
||||
};
|
||||
|
||||
class WindowMouseButtonPressedEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowMouseButtonPressedEvent() : button(0) {}
|
||||
|
||||
WindowMouseButtonPressedEvent(unsigned int b) : button(b) {}
|
||||
|
||||
~WindowMouseButtonPressedEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowMouseButtonPressedEvent"; }
|
||||
|
||||
unsigned int button;
|
||||
};
|
||||
|
||||
class WindowMouseButtonReleasedEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowMouseButtonReleasedEvent() : button(0) {}
|
||||
|
||||
WindowMouseButtonReleasedEvent(unsigned int b) : button(b) {}
|
||||
|
||||
~WindowMouseButtonReleasedEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowMouseButtonReleasedEvent"; }
|
||||
|
||||
unsigned int button;
|
||||
};
|
||||
|
||||
class WindowScrollEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowScrollEvent() : dx(0), dy(0) {}
|
||||
|
||||
WindowScrollEvent(double x, double y) : dx(x), dy(y) {}
|
||||
|
||||
~WindowScrollEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowScrollEvent"; }
|
||||
|
||||
double dx, dy;
|
||||
};
|
||||
|
||||
class WindowMouseMovedEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowMouseMovedEvent() : x(0), y(0) {}
|
||||
|
||||
WindowMouseMovedEvent(int x, int y) : x(x), y(y) {}
|
||||
|
||||
~WindowMouseMovedEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowMouseMovedEvent"; }
|
||||
|
||||
int x, y;
|
||||
};
|
||||
|
||||
class WindowFocusedEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowFocusedEvent() : window(nullptr) {}
|
||||
|
||||
WindowFocusedEvent(const Window* w) : window(w) {}
|
||||
|
||||
~WindowFocusedEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowFocusedEvent"; }
|
||||
|
||||
const Window* window;
|
||||
};
|
||||
|
||||
class WindowFocusLostEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowFocusLostEvent() : window(nullptr) {}
|
||||
|
||||
WindowFocusLostEvent(const Window* w) : window(w) {}
|
||||
|
||||
~WindowFocusLostEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowFocusLostEvent"; }
|
||||
|
||||
const Window* window;
|
||||
};
|
||||
|
||||
class WindowMovedEvent : public Event {
|
||||
|
||||
public:
|
||||
|
||||
WindowMovedEvent() : x(0), y(0) {}
|
||||
|
||||
WindowMovedEvent(int x, int y) : x(x), y(y) {}
|
||||
|
||||
~WindowMovedEvent() {
|
||||
|
||||
}
|
||||
|
||||
operator std::string() const { return "Archimedes::WindowMovedEvent"; }
|
||||
|
||||
int x, y;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user