-
Notifications
You must be signed in to change notification settings - Fork 6
/
common.c
38 lines (29 loc) · 896 Bytes
/
common.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
void abort_example(char const *format, ...);
#ifdef ALLEGRO_POPUP_EXAMPLES
void abort_example(char const *format, ...)
{
char str[1024];
va_list args;
va_start(args, format);
vsnprintf(str, sizeof str, format, args);
va_end(args);
// FIXME: We could check here if Allegro is installed and/or a display is
// active - but it's probably better if make al_show_native_message_box
// does that instead and falls back to other means to deliver the message
// on all platforms (even without A5 installed or a display active).
al_show_native_message_box(NULL, "Error", "Cannot run example", str, NULL, 0);
exit(1);
}
#else
void abort_example(char const *format, ...)
{
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
exit(1);
}
#endif