aboutsummaryrefslogtreecommitdiffstats
path: root/pugl_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'pugl_test.c')
-rw-r--r--pugl_test.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/pugl_test.c b/pugl_test.c
index 3122a89..f6d9ac2 100644
--- a/pugl_test.c
+++ b/pugl_test.c
@@ -18,6 +18,14 @@
@file pugl_test.c A simple Pugl test that creates a top-level window.
*/
+/*
+ This program uses only the the Pugl and OpenGL APIs, but the Windows
+ gl.h is broken and requires windows.h to be included first...
+*/
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
#include <stdio.h>
#include "GL/gl.h"
@@ -51,7 +59,7 @@ onDisplay(PuglWindow* win)
static void
onKeyboard(PuglWindow* win, bool press, uint32_t key)
{
- if (key == 'q' || key == KEY_ESCAPE) {
+ if (key == 'q' || key == 'Q' || key == KEY_ESCAPE) {
quit = 1;
}
}
@@ -65,6 +73,12 @@ onMotion(PuglWindow* win, int x, int y)
}
static void
+onMouse(PuglWindow* handle, int button, int state, int x, int y)
+{
+ fprintf(stderr, "Mouse %d at %d,%d\n", button, x, y);
+}
+
+static void
onClose(PuglWindow* win)
{
quit = 1;
@@ -76,6 +90,7 @@ main(int argc, char** argv)
PuglWindow* win = puglCreate(0, "Pugl Test", 512, 512);
puglSetKeyboardFunc(win, onKeyboard);
puglSetMotionFunc(win, onMotion);
+ puglSetMouseFunc(win, onMouse);
puglSetDisplayFunc(win, onDisplay);
puglSetCloseFunc(win, onClose);