blob: 88a025cb36330f5776e9085aec639173337b6df1 (
plain)
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
|
#ifndef MGLPP_WINDOW_HPP
#define MGLPP_WINDOW_HPP
#include "../graphics/PrimitiveType.hpp"
#include "../graphics/Color.hpp"
#include "../system/vec.hpp"
#include <stddef.h>
extern "C" {
#include <mgl/window/window.h>
}
namespace mgl {
typedef mgl_window_handle WindowHandle;
class Event;
class Drawable;
class Shader;
class Vertex;
class Window {
public:
class Delegate {
public:
virtual ~Delegate() = default;
virtual void draw() = 0;
};
Window();
~Window();
bool create(const char *title, int width, int height);
// Initialize this window from an existing window
bool create(WindowHandle existing_window);
bool poll_event(Event &event);
void clear(Color color = Color(0, 0, 0, 255));
void draw(Drawable &drawable, Shader *shader = nullptr);
void draw(const Vertex *vertices, size_t vertex_count, PrimitiveType primitive_type, Shader *shader = nullptr);
void display();
bool is_open() const;
bool has_focus() const;
void close();
void set_title(const char *title);
void set_framerate_limit(unsigned int fps);
void set_key_repeat_enabled(bool enabled);
void set_cursor_visible(bool visible);
vec2i get_size() const;
vec2i get_cursor_position() const;
WindowHandle get_system_handle() const;
private:
mgl_window window;
};
}
#endif /* MGLPP_WINDOW_HPP */
|