🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
845 B

  1. #include "SDL.h"
  2. #include <stdio.h>
  3. int main(int argc, char *argv[]) {
  4. SDL_Window *window = NULL;
  5. SDL_Surface *screenSurface = NULL;
  6. if (SDL_Init(SDL_INIT_VIDEO) < 0) {
  7. fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError());
  8. return 1;
  9. }
  10. window = SDL_CreateWindow(
  11. "hello_sdl2",
  12. SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
  13. 640, 480,
  14. SDL_WINDOW_SHOWN
  15. );
  16. if (window == NULL) {
  17. fprintf(stderr, "could not create window: %s\n", SDL_GetError());
  18. return 1;
  19. }
  20. screenSurface = SDL_GetWindowSurface(window);
  21. SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xff, 0xff, 0xff));
  22. SDL_UpdateWindowSurface(window);
  23. SDL_Delay(100);
  24. SDL_DestroyWindow(window);
  25. SDL_Quit();
  26. return 0;
  27. }