2022-11-27 10:36:54 -07:00
|
|
|
#include <SDL3/SDL.h>
|
2022-12-14 21:58:20 -07:00
|
|
|
#include <SDL3/SDL_main.h>
|
2022-06-03 12:07:43 -06:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
SDL_Window *window = NULL;
|
|
|
|
SDL_Surface *screenSurface = NULL;
|
|
|
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
2022-11-21 21:28:58 -07:00
|
|
|
fprintf(stderr, "Could not initialize SDL: %s\n", SDL_GetError());
|
2022-06-03 12:07:43 -06:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
window = SDL_CreateWindow(
|
2022-11-21 21:28:58 -07:00
|
|
|
"Hello SDL",
|
2022-06-03 12:07:43 -06:00
|
|
|
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
|
|
|
|
640, 480,
|
|
|
|
SDL_WINDOW_SHOWN
|
|
|
|
);
|
|
|
|
if (window == NULL) {
|
|
|
|
fprintf(stderr, "could not create window: %s\n", SDL_GetError());
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
screenSurface = SDL_GetWindowSurface(window);
|
2022-12-27 09:25:31 -07:00
|
|
|
SDL_FillSurfaceRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xff, 0xff, 0xff));
|
2022-06-03 12:07:43 -06:00
|
|
|
SDL_UpdateWindowSurface(window);
|
|
|
|
SDL_Delay(100);
|
|
|
|
SDL_DestroyWindow(window);
|
|
|
|
SDL_Quit();
|
|
|
|
return 0;
|
|
|
|
}
|