summaryrefslogtreecommitdiff
path: root/procyon/source/gfx/initgfx.c
diff options
context:
space:
mode:
Diffstat (limited to 'procyon/source/gfx/initgfx.c')
-rw-r--r--procyon/source/gfx/initgfx.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/procyon/source/gfx/initgfx.c b/procyon/source/gfx/initgfx.c
new file mode 100644
index 0000000..d60e393
--- /dev/null
+++ b/procyon/source/gfx/initgfx.c
@@ -0,0 +1,22 @@
+#include <acm/gfx.h>
+
+#include <GLFW/glfw3.h>
+
+void acm_initgfx(void) {
+ acm_log("Initialising graphics\n");
+ if (!glfwInit()) {
+ fprintf(stderr,"Unable to initialise GLFW\n");
+ acm_exit(acm_stat_err);
+ }
+ GLFWwindow * win = glfwCreateWindow(0x300,0x200,"Procyon",nullptr,nullptr);
+ if (win == nullptr) {
+ fprintf(stderr,"Unable to open window\n");
+ goto abrt;
+ }
+ glfwMakeContextCurrent(win);
+ acm_dat.win = win;
+ return;
+abrt:;
+ glfwTerminate();
+ acm_exit(acm_stat_err);
+}