From 8222bfe56d4dabe8d92fc4b25ea1b0163b16f3e1 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 4 May 2024 16:51:29 -0700 Subject: Initial commit. --- src/contrib/SDL-2.30.2/cmake/test/main_gui.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/contrib/SDL-2.30.2/cmake/test/main_gui.c (limited to 'src/contrib/SDL-2.30.2/cmake/test/main_gui.c') 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 @@ +#include "SDL.h" +#include + +int main(int argc, char *argv[]) { + SDL_Window *window = NULL; + SDL_Surface *screenSurface = NULL; + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError()); + return 1; + } + window = SDL_CreateWindow( + "hello_sdl2", + SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, + 640, 480, + SDL_WINDOW_SHOWN + ); + if (!window) { + fprintf(stderr, "could not create window: %s\n", SDL_GetError()); + return 1; + } + screenSurface = SDL_GetWindowSurface(window); + SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xff, 0xff, 0xff)); + SDL_UpdateWindowSurface(window); + SDL_Delay(100); + SDL_DestroyWindow(window); + SDL_Quit(); + return 0; +} -- cgit v1.2.3