-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreen.h
More file actions
79 lines (54 loc) · 1.87 KB
/
screen.h
File metadata and controls
79 lines (54 loc) · 1.87 KB
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
#ifndef SCREEN_H
#define SCREEN_H
#include "item.h"
#include "color.h"
struct GLFWwindow;
struct GLFWcursor;
class Popup;
class Screen: public Item
{
public:
Screen(float w, float h, float dpr);
virtual ~Screen();
void updateFocus(Item *widget);
GLFWwindow* window() { return mGLFWWindow; }
NVGcontext* vg() { return mNVGContext; }
void setBackground(Color color);
/// Draw the Screen contents
virtual void drawAll();
/// Draw the window contents --- put your OpenGL draw calls here
virtual void drawContents() { /* To be overridden */ }
void drawWidgets();
void setCursor(Cursor cursor);
Popup* popup() { return mPopup; }
protected:
void initialize(GLFWwindow *window);
/// Handle a file drop event
virtual bool dropEvent(const std::vector<std::string> & /* filenames */) { return false; /* To be overridden */ }
bool keyboardEvent(int key, int scancode, int action, int modifiers);
bool keyboardCharacterEvent(unsigned int codepoint);
bool cursorPosCallbackEvent(float x, float y);
bool mouseButtonCallbackEvent(int button, int action, int modifiers);
bool keyCallbackEvent(int key, int scancode, int action, int mods);
bool charCallbackEvent(unsigned int codepoint);
bool dropCallbackEvent(int count, const char **filenames);
bool resizeCallbackEvent(int, int);
private:
Color mColor;
std::vector<Item *> mFocusPath;
bool mDragActive;
Popup *mPopup;
Item *mDragWidget = nullptr;
float mPixelRatio;
GLFWwindow *mGLFWWindow;
NVGcontext* mNVGContext;
GLFWcursor *mCursors[(int) Cursor::CursorCount];
Cursor mCursor = Cursor::Arrow;
int mMouseState, mModifiers;
float mMousePos[2];
int mFBSize[2];
int mSize[2];
};
typedef void (*ScreenReadyCallback)(Screen*);
int app_exec(ScreenReadyCallback screenReadyCallback);
#endif // SCREEN_H