210 lines
4.6 KiB
C++
210 lines
4.6 KiB
C++
#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 ResizeWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
ResizeWindowEvent() : width(0), height(0) {}
|
|
|
|
ResizeWindowEvent(int w, int h) : width(w), height(h) {}
|
|
|
|
~ResizeWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::ResizeWindowEvent"; }
|
|
|
|
int width, height;
|
|
|
|
};
|
|
|
|
class CloseWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
CloseWindowEvent() : window(nullptr) {}
|
|
|
|
CloseWindowEvent(const Window* w) : window(w) {}
|
|
|
|
~CloseWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::CloseWindowEvent"; }
|
|
|
|
const Window* window;
|
|
};
|
|
|
|
class KeyPressedWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
KeyPressedWindowEvent() : key(0), repeat(0) {}
|
|
|
|
KeyPressedWindowEvent(unsigned int k, unsigned int r) : key(k), repeat(r) {}
|
|
|
|
~KeyPressedWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::KeyPressedWindowEvent"; }
|
|
|
|
unsigned int key;
|
|
unsigned int repeat;
|
|
};
|
|
|
|
class KeyReleasedWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
KeyReleasedWindowEvent() : key(0) {}
|
|
|
|
KeyReleasedWindowEvent(unsigned int k) : key(k) {}
|
|
|
|
~KeyReleasedWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::KeyReleasedWindowEvent"; }
|
|
|
|
unsigned int key;
|
|
};
|
|
|
|
class MouseButtonPressedWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
MouseButtonPressedWindowEvent() : button(0) {}
|
|
|
|
MouseButtonPressedWindowEvent(unsigned int b) : button(b) {}
|
|
|
|
~MouseButtonPressedWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::MouseButtonPressedWindowEvent"; }
|
|
|
|
unsigned int button;
|
|
};
|
|
|
|
class MouseButtonReleasedWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
MouseButtonReleasedWindowEvent() : button(0) {}
|
|
|
|
MouseButtonReleasedWindowEvent(unsigned int b) : button(b) {}
|
|
|
|
~MouseButtonReleasedWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::MouseButtonReleasedWindowEvent"; }
|
|
|
|
unsigned int button;
|
|
};
|
|
|
|
class ScrollWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
ScrollWindowEvent() : dx(0), dy(0) {}
|
|
|
|
ScrollWindowEvent(double x, double y) : dx(x), dy(y) {}
|
|
|
|
~ScrollWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::ScrollWindowEvent"; }
|
|
|
|
double dx, dy;
|
|
};
|
|
|
|
class MouseMovedWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
MouseMovedWindowEvent() : x(0), y(0) {}
|
|
|
|
MouseMovedWindowEvent(double x, double y) : x(x), y(y) {}
|
|
|
|
~MouseMovedWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::MouseMovedWindowEvent"; }
|
|
|
|
double x, y;
|
|
};
|
|
|
|
class FocusedWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
FocusedWindowEvent() : window(nullptr) {}
|
|
|
|
FocusedWindowEvent(const Window* w) : window(w) {}
|
|
|
|
~FocusedWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::FocusedWindowEvent"; }
|
|
|
|
const Window* window;
|
|
};
|
|
|
|
class FocusLostWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
FocusLostWindowEvent() : window(nullptr) {}
|
|
|
|
FocusLostWindowEvent(const Window* w) : window(w) {}
|
|
|
|
~FocusLostWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::FocusLostWindowEvent"; }
|
|
|
|
const Window* window;
|
|
};
|
|
|
|
class MovedWindowEvent : public Event {
|
|
|
|
public:
|
|
|
|
MovedWindowEvent() : x(0), y(0) {}
|
|
|
|
MovedWindowEvent(int x, int y) : x(x), y(y) {}
|
|
|
|
~MovedWindowEvent() {
|
|
|
|
}
|
|
|
|
operator std::string() const override { return "Archimedes::MovedWindowEvent"; }
|
|
|
|
int x, y;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|