aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/libui/common/shouldquit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libui_sdl/libui/common/shouldquit.c')
-rw-r--r--src/libui_sdl/libui/common/shouldquit.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libui_sdl/libui/common/shouldquit.c b/src/libui_sdl/libui/common/shouldquit.c
new file mode 100644
index 0000000..4e7aa5c
--- /dev/null
+++ b/src/libui_sdl/libui/common/shouldquit.c
@@ -0,0 +1,22 @@
+// 9 may 2015
+#include "../ui.h"
+#include "uipriv.h"
+
+static int defaultOnShouldQuit(void *data)
+{
+ return 0;
+}
+
+static int (*onShouldQuit)(void *) = defaultOnShouldQuit;
+static void *onShouldQuitData;
+
+void uiOnShouldQuit(int (*f)(void *), void *data)
+{
+ onShouldQuit = f;
+ onShouldQuitData = data;
+}
+
+int shouldQuit(void)
+{
+ return (*onShouldQuit)(onShouldQuitData);
+}