1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#ifndef __FLATWINDOW_H__
#define __FLATWINDOW_H__
#include <string>
struct window_status
{
window_status( unsigned char fullscreen = 0,
unsigned char hidden = 0,
unsigned char borderless = 0,
unsigned char resizable = 1,
unsigned char minimized = 0,
unsigned char maximized = 0,
unsigned char focus = 1)
: fullscreen(fullscreen), hidden(hidden), borderless(borderless),
resizable(resizable), minimized(minimized), maximized(maximized),
focus(focus) {}
unsigned char fullscreen:1;
unsigned char hidden:1;
unsigned char borderless:1;
unsigned char resizable:1;
unsigned char minimized:1;
unsigned char maximized:1;
unsigned char focus:1;
};
#include "object.hpp"
#include "serial/keyfocusable.h"
class SDL_Window;
class FlatLayer;
class SDL_KeyEvent;
class FlatWindow : virtual public flat::core::object, public KeyFocusable
{
std::string title;
window_status status;
SDL_Rect * bounds;
SDL_Window * sdl_window;
SDL_Surface * screen;
FlatLayer * main_layer;
void key_cb(const SDL_KeyboardEvent*) override;
// TODO window calls
//protected:
//virtual void resizeEvent();
//virtual void quitEvent();
public:
FlatWindow(int x, int y,
int width, int height,
const std::string& title,
window_status status = window_status());
FlatWindow( SDL_Rect *bounds, const std::string& title,
window_status status = window_status());
FlatWindow( int width, int height,
const std::string &title,
window_status status = window_status());
FlatWindow(const FlatWindow&);
~FlatWindow();
int open();
void close();
int getWidth() const;
int getHeight() const;
const SDL_Rect * getBounds() const;
SDL_Window * getSDLWindow();
SDL_Surface * getScreenSurface();
const std::string& getTitle() const;
void setTitle(const std::string&);
window_status getWindowStatus() const;
void setWindowStatus(window_status);
static uint32_t winstatus_to_flags(window_status);
};
#endif
|