summaryrefslogtreecommitdiff
path: root/rgfw.c3
blob: 3dd069273f4e3b5a3ebad47bf58022fa264b8704 (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
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
module rgfw;

alias Window = void;
alias GlContext = void;
alias EglContext = void;
alias Proc = fn void ();

enum GlReleaseBehavior: int
{
  GL_RELEASE_FLUSH,
  GL_RELEASE_NONE,
}

enum GlProfile: int
{
  GL_CORE,
  GL_FORWARD_COMPATIBILITY,
  GL_COMPATIBILITY,
  GL_ES,
}

enum GlRenderer: int
{
  GL_ACCELERATED,
  GL_SOFTWARE,
}

constdef WindowFlags : uint
{
  WINDOW_NO_BORDER = 1 << 0,
  WINDOW_NO_RESIZE = 1 << 1,
  WINDOW_ALLOW_DND = 1 << 2,
  WINDOW_HIDE_MOUSE = 1 << 3,
  WINDOW_FULLSCREEN = 1 << 4,
  WINDOW_TRANSLUCENT = 1 << 5,
  WINDOW_TRANSPARENT = WINDOW_TRANSLUCENT,
  WINDOW_CENTER = 1 << 6,
  WINDOW_RAW_MOUSE = 1 << 7,
  WINDOW_SCALE_TO_MONITOR = 1 << 8,
  WINDOW_HIDE = 1 << 9,
  WINDOW_MAXIMIZE = 1 << 10,
  WINDOW_CENTER_CURSOR = 1 << 11,
  WINDOW_FLOATING = 1 << 12,
  WINDOW_FOCUS_ON_SHOW = 1 << 13,
  WINDOW_MINIMIZE = 1 << 14,
  WINDOW_FOCUS = 1 << 15,
  WINDOW_CAPTURE_MOUSE = 1 << 16,
  WINDOW_OPENGL = 1 << 17,
  WINDOW_EGL = 1 << 18,
  NO_DEINIT_ON_CLOSE = 1 << 19,
  WINDOWED_FULLSCREEN = WINDOW_NO_BORDER | WINDOW_MAXIMIZE,
  WINDOW_CAPTURE_RAW_MOUSE = WINDOW_CAPTURE_MOUSE | WINDOW_RAW_MOUSE,
}

struct GlHints
{
  int stencil;
  int samples;
  int stereo;
  int auxBuffers;
  int doubleBuffer;
  int red; int green; int blue; int alpha;
  int depth;
  int accumRed; int accumGreen; int accumBlue; int accumAlpha;
  bool sRGB;
  bool robustness;
  bool debug;
  bool noError;
  GlReleaseBehavior releaseBehavior;
  GlProfile profile;
  int major; int minor;
  GlContext* share;
  EglContext* shareEGL;
  GlRenderer renderer;
}

extern fn Window*  createWindow(ZString, int, int, int, int, WindowFlags) @cname("RGFW_createWindow");
extern fn bool     window_shouldClose(Window*)                            @cname("RGFW_window_shouldClose");
extern fn bool     window_close(Window*)                                  @cname("RGFW_window_close");
extern fn void     pollEvents()                                           @cname("RGFW_pollEvents");
extern fn GlHints* getGlobalHints_OpenGL()                                @cname("RGFW_getGlobalHints_OpenGL");
extern fn void     setGlobalHints_OpenGL(GlHints*)                        @cname("RGFW_setGlobalHints_OpenGL");
extern fn Proc     getProcAddress_OpenGL(ZString)                         @cname("RGFW_getProcAddress_OpenGL");