aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/libui/common/shouldquit.c
blob: 4e7aa5c32297321d5178420963b7801a8cd97dd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
}