summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-2.30.2/cmake/test/main_gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/contrib/SDL-2.30.2/cmake/test/main_gui.c')
-rw-r--r--src/contrib/SDL-2.30.2/cmake/test/main_gui.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/contrib/SDL-2.30.2/cmake/test/main_gui.c b/src/contrib/SDL-2.30.2/cmake/test/main_gui.c
new file mode 100644
index 0000000..ca2d92e
--- /dev/null
+++ b/src/contrib/SDL-2.30.2/cmake/test/main_gui.c
@@ -0,0 +1,28 @@
1#include "SDL.h"
2#include <stdio.h>
3
4int main(int argc, char *argv[]) {
5 SDL_Window *window = NULL;
6 SDL_Surface *screenSurface = NULL;
7 if (SDL_Init(SDL_INIT_VIDEO) < 0) {
8 fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError());
9 return 1;
10 }
11 window = SDL_CreateWindow(
12 "hello_sdl2",
13 SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
14 640, 480,
15 SDL_WINDOW_SHOWN
16 );
17 if (!window) {
18 fprintf(stderr, "could not create window: %s\n", SDL_GetError());
19 return 1;
20 }
21 screenSurface = SDL_GetWindowSurface(window);
22 SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xff, 0xff, 0xff));
23 SDL_UpdateWindowSurface(window);
24 SDL_Delay(100);
25 SDL_DestroyWindow(window);
26 SDL_Quit();
27 return 0;
28}