placing white holes, and changed to n-body gravitational pull instead of
[ld42_outofspace] / src / goatkit / screen.h
1 /*
2 GoatKit - a themable/animated widget toolkit for games
3 Copyright (C) 2014-2018 John Tsiombikas <nuclear@member.fsf.org>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef GOATKIT_SCREEN_H_
19 #define GOATKIT_SCREEN_H_
20
21 #include "vec.h"
22 #include "widget.h"
23
24 namespace goatkit {
25
26 class ScreenImpl;
27
28 class Screen {
29 private:
30         ScreenImpl *scr;
31
32 public:
33         Screen();
34         ~Screen();
35
36         void set_position(float x, float y);
37         void set_position(const Vec2 &pos);
38         const Vec2 &get_position() const;
39         void set_size(float x, float y);
40         void set_size(const Vec2 &sz);
41         const Vec2 get_size() const;
42         const BBox &get_box() const;
43
44         void add_widget(Widget *w);
45         int get_widget_count() const;
46         Widget *get_widget(int idx) const;
47         Widget *get_widget(const char *name) const;
48
49         void show();
50         void hide();
51         bool is_visible() const;
52         float get_visibility() const;
53         void set_visibility_transition(long msec);
54         long get_visibility_transition() const;
55
56         bool grab_mouse(Widget *w);
57         Widget *get_mouse_grab() const;
58
59         void draw() const;
60
61         // window system events used to generate widget events (see event.h)
62         void sysev_keyboard(int key, bool press);
63         // mouse position as reported by the window system. might fall outside
64         void sysev_mouse_button(int bn, bool press, float x, float y);
65         void sysev_mouse_motion(float x, float y);
66 };
67
68 }       // namespace goatkit
69
70 #endif /* GOATKIT_SCREEN_H_ */