2018-10-10 15:12:38 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-10-10 16:49:36 +02:00
|
|
|
#include "Object.h"
|
2018-10-14 00:21:42 +02:00
|
|
|
#include "Rect.h"
|
2019-01-09 02:06:04 +01:00
|
|
|
#include "Size.h"
|
2019-01-11 03:52:09 +01:00
|
|
|
#include "PS2MouseDevice.h"
|
2018-10-10 16:49:36 +02:00
|
|
|
|
2019-01-11 03:52:09 +01:00
|
|
|
class AbstractScreen : public Object, public MouseClient {
|
2018-10-10 15:12:38 +02:00
|
|
|
public:
|
|
|
|
virtual ~AbstractScreen();
|
|
|
|
|
2018-12-02 23:41:10 +01:00
|
|
|
int width() const { return m_width; }
|
|
|
|
int height() const { return m_height; }
|
2018-10-10 15:12:38 +02:00
|
|
|
|
|
|
|
static AbstractScreen& the();
|
|
|
|
|
2019-01-09 02:06:04 +01:00
|
|
|
Size size() const { return { width(), height() }; }
|
2018-10-14 00:21:42 +02:00
|
|
|
Rect rect() const { return { 0, 0, width(), height() }; }
|
|
|
|
|
2019-01-11 01:43:41 +01:00
|
|
|
static void initialize();
|
|
|
|
|
2019-01-11 03:52:09 +01:00
|
|
|
Point cursor_location() const { return m_cursor_location; }
|
|
|
|
bool left_mouse_button_pressed() const { return m_left_mouse_button_pressed; }
|
|
|
|
bool right_mouse_button_pressed() const { return m_right_mouse_button_pressed; }
|
|
|
|
|
2018-10-10 15:12:38 +02:00
|
|
|
protected:
|
|
|
|
AbstractScreen(unsigned width, unsigned height);
|
|
|
|
|
|
|
|
private:
|
2019-01-11 03:52:09 +01:00
|
|
|
// ^MouseClient
|
|
|
|
virtual void did_receive_mouse_data(int dx, int dy, bool left_button, bool right_button) final;
|
|
|
|
|
2018-12-02 23:41:10 +01:00
|
|
|
int m_width { 0 };
|
|
|
|
int m_height { 0 };
|
2019-01-11 03:52:09 +01:00
|
|
|
|
|
|
|
Point m_cursor_location;
|
|
|
|
bool m_left_mouse_button_pressed { false };
|
|
|
|
bool m_right_mouse_button_pressed { false };
|
2018-10-10 15:12:38 +02:00
|
|
|
};
|
|
|
|
|