aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-10 10:59:43 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-10 10:59:43 +0200
commite57daa001cc74682cdb905d8e0c6c8c3a2c29372 (patch)
treec057e00453a3d46df494d75882285ef35a47825a /include
Initial commit, skeleton
Diffstat (limited to 'include')
-rw-r--r--include/mgl/glx.h15
-rw-r--r--include/mgl/mgl.h29
-rw-r--r--include/mgl/window.h12
3 files changed, 56 insertions, 0 deletions
diff --git a/include/mgl/glx.h b/include/mgl/glx.h
new file mode 100644
index 0000000..dfb736d
--- /dev/null
+++ b/include/mgl/glx.h
@@ -0,0 +1,15 @@
+#ifndef MGL_GLX_H
+#define MGL_GLX_H
+
+typedef struct _XDisplay Display;
+typedef struct __GLXFBConfigRec *GLXFBConfig;
+
+typedef struct {
+ void *handle;
+ GLXFBConfig* (*glXGetFBConfigs)(Display *dpy, int screen, int *nelements);
+} mgl_glx;
+
+int mgl_glx_load(mgl_glx *self);
+void mgl_glx_unload(mgl_glx *self);
+
+#endif /* MGL_GLX_H */
diff --git a/include/mgl/mgl.h b/include/mgl/mgl.h
new file mode 100644
index 0000000..d896497
--- /dev/null
+++ b/include/mgl/mgl.h
@@ -0,0 +1,29 @@
+#ifndef MGL_MGL_H
+#define MGL_MGL_H
+
+#include "glx.h"
+
+/* Display* on x11 */
+typedef void* mgl_connection;
+
+typedef struct {
+ mgl_connection connection;
+ mgl_glx glx;
+} mgl_context;
+
+/*
+ Safe to call multiple times, but will only be initialized the first time called.
+ Returns non-0 value on failure.
+ Note: not thread safe.
+*/
+int mgl_init(void);
+
+/*
+ Safe to call multiple times, but will only be deinitialized the last time called.
+ Note: not thread safe.
+*/
+void mgl_deinit(void);
+
+mgl_context* mgl_get_context(void);
+
+#endif /* MGL_MGL_H */
diff --git a/include/mgl/window.h b/include/mgl/window.h
new file mode 100644
index 0000000..bd29936
--- /dev/null
+++ b/include/mgl/window.h
@@ -0,0 +1,12 @@
+#ifndef MGL_WINDOW_H
+#define MGL_WINDOW_H
+
+typedef struct {
+ int booba;
+} mgl_window;
+
+void mgl_window_init(mgl_window *self);
+void mgl_window_deinit(mgl_window *self);
+void mgl_window_show(mgl_window *self);
+
+#endif /* MGL_WINDOW_H */