summaryrefslogtreecommitdiff
path: root/pugl_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-29 02:12:26 +0000
committerDavid Robillard <d@drobilla.net>2012-04-29 02:12:26 +0000
commite346dc20fb1fcbc8f895d7c46e3ec54628d3db0c (patch)
tree0b6d83ef9b8daf7a4fa57cd384a1abc33602906e /pugl_test.c
parent43083a0ca80a876286b6a6ef39ec6f10c9b6f9bf (diff)
Windows implementation.
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);