aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-10 12:56:55 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-10 13:18:12 +0200
commit3b2fceed064c06d55e1cd33d51e855e909c81f75 (patch)
tree962611955ddac906d906af1b44076d7cfae2bb64 /tests
parente57daa001cc74682cdb905d8e0c6c8c3a2c29372 (diff)
add event and test graphics
Diffstat (limited to 'tests')
-rw-r--r--tests/main.c31
-rw-r--r--tests/project.conf3
2 files changed, 33 insertions, 1 deletions
diff --git a/tests/main.c b/tests/main.c
index ff1570b..e6a4f5a 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -1,6 +1,35 @@
#include <stdio.h>
+#include <mgl/mgl.h>
+#include <mgl/window.h>
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+static void draw(mgl_window *window, void *userdata) {
+ glBegin(GL_QUADS);
+ glColor3f(1., 0., 0.); glVertex3f(-.75, -.75, 0.);
+ glColor3f(0., 1., 0.); glVertex3f( .75, -.75, 0.);
+ glColor3f(0., 0., 1.); glVertex3f( .75, .75, 0.);
+ glColor3f(1., 1., 0.); glVertex3f(-.75, .75, 0.);
+ glEnd();
+}
int main(int argc, char **argv) {
- printf("hello, world!\n");
+ if(mgl_init() != 0)
+ return 1;
+
+ mgl_window_callback window_callback;
+ window_callback.draw = draw;
+
+ mgl_window window;
+ if(mgl_window_create(&window, "mgl", 1280, 720, &window_callback, NULL) != 0)
+ return 1;
+
+ mgl_window_show(&window);
+ for(;;) {
+ mgl_window_event_poll(&window, 500);
+ }
+
+ mgl_window_deinit(&window);
+ mgl_deinit();
return 0;
}
diff --git a/tests/project.conf b/tests/project.conf
new file mode 100644
index 0000000..3c15235
--- /dev/null
+++ b/tests/project.conf
@@ -0,0 +1,3 @@
+[dependencies]
+gl = ">=1"
+glu = ">=9"