main_gui.c 882 B

1234567891011121314151617181920212223242526272829
  1. #include <SDL3/SDL.h>
  2. #include <SDL3/SDL_main.h>
  3. #include <stdio.h>
  4. int 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 SDL: %s\n", SDL_GetError());
  9. return 1;
  10. }
  11. window = SDL_CreateWindow(
  12. "Hello SDL",
  13. SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
  14. 640, 480,
  15. SDL_WINDOW_SHOWN
  16. );
  17. if (window == NULL) {
  18. fprintf(stderr, "could not create window: %s\n", SDL_GetError());
  19. return 1;
  20. }
  21. screenSurface = SDL_GetWindowSurface(window);
  22. SDL_FillSurfaceRect(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. }