78 lines
1.8 KiB
C++
78 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <frostbite2D/event/event.h>
|
|
#include <SDL2/SDL_events.h>
|
|
|
|
namespace frostbite2D {
|
|
|
|
class WindowEvent : public Event {
|
|
public:
|
|
WindowEvent(EventType type, uint32 timestamp, int32 windowId)
|
|
: Event(timestamp)
|
|
, type_(type)
|
|
, windowId_(windowId) {}
|
|
|
|
EventType getType() const override {
|
|
return type_;
|
|
}
|
|
|
|
int32 getWindowId() const { return windowId_; }
|
|
|
|
protected:
|
|
EventType type_;
|
|
int32 windowId_;
|
|
};
|
|
|
|
class WindowCloseEvent : public WindowEvent {
|
|
public:
|
|
WindowCloseEvent(uint32 timestamp, int32 windowId)
|
|
: WindowEvent(EventType::WindowClose, timestamp, windowId) {}
|
|
};
|
|
|
|
class WindowResizeEvent : public WindowEvent {
|
|
public:
|
|
WindowResizeEvent(uint32 timestamp, int32 windowId, int32 width, int32 height)
|
|
: WindowEvent(EventType::WindowResize, timestamp, windowId)
|
|
, width_(width)
|
|
, height_(height) {}
|
|
|
|
int32 getWidth() const { return width_; }
|
|
int32 getHeight() const { return height_; }
|
|
|
|
private:
|
|
int32 width_;
|
|
int32 height_;
|
|
};
|
|
|
|
class WindowFocusEvent : public WindowEvent {
|
|
public:
|
|
WindowFocusEvent(uint32 timestamp, int32 windowId, bool focused)
|
|
: WindowEvent(EventType::WindowFocus, timestamp, windowId)
|
|
, focused_(focused) {}
|
|
|
|
bool isFocused() const { return focused_; }
|
|
|
|
private:
|
|
bool focused_;
|
|
};
|
|
|
|
class WindowMinimizeEvent : public WindowEvent {
|
|
public:
|
|
WindowMinimizeEvent(uint32 timestamp, int32 windowId)
|
|
: WindowEvent(EventType::WindowMinimize, timestamp, windowId) {}
|
|
};
|
|
|
|
class WindowMaximizeEvent : public WindowEvent {
|
|
public:
|
|
WindowMaximizeEvent(uint32 timestamp, int32 windowId)
|
|
: WindowEvent(EventType::WindowMaximize, timestamp, windowId) {}
|
|
};
|
|
|
|
class WindowRestoreEvent : public WindowEvent {
|
|
public:
|
|
WindowRestoreEvent(uint32 timestamp, int32 windowId)
|
|
: WindowEvent(EventType::WindowRestore, timestamp, windowId) {}
|
|
};
|
|
|
|
}
|