From 1365dd607f51217017f6de4c7246626a6fdd07e8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 30 Apr 2012 20:37:54 +0000 Subject: Add puglIgnoreKeyRepeat and implement on X11. Add proper command line options for pugl_test. --- pugl_test.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'pugl_test.c') diff --git a/pugl_test.c b/pugl_test.c index da58b78..6eeed1a 100644 --- a/pugl_test.c +++ b/pugl_test.c @@ -19,6 +19,7 @@ */ #include +#include #include "pugl/pugl.h" @@ -135,8 +136,26 @@ onClose(PuglView* view) int main(int argc, char** argv) { - bool resizable = argc > 1; - PuglView* view = puglCreate(0, "Pugl Test", 512, 512, resizable); + bool ignoreKeyRepeat = false; + bool resizable = false; + for (int i = 1; i < argc; ++i) { + if (!strcmp(argv[i], "-h")) { + printf("USAGE: %s [OPTIONS]...\n\n" + " -h Display this help\n" + " -i Ignore key repeat\n" + " -r Resizable window\n", argv[0]); + return 0; + } else if (!strcmp(argv[i], "-i")) { + ignoreKeyRepeat = true; + } else if (!strcmp(argv[i], "-r")) { + resizable = true; + } else { + fprintf(stderr, "Unknown option: %s\n", argv[i]); + } + } + + PuglView* view = puglCreate(0, "Pugl Test", 512, 512, resizable); + puglIgnoreKeyRepeat(view, ignoreKeyRepeat); puglSetKeyboardFunc(view, onKeyboard); puglSetMotionFunc(view, onMotion); puglSetMouseFunc(view, onMouse); -- cgit v1.2.3