Created
November 12, 2025 02:03
-
-
Save weirddan455/8fe5bf7f7f5fda58d88a8acafa096296 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL2/SDL.h> | |
| #include <stdio.h> | |
| int main(int argc, char *argv[]) | |
| { | |
| if (SDL_Init(SDL_INIT_VIDEO) != 0) { | |
| fprintf(stderr, "SDL_Init failed\n"); | |
| return 1; | |
| } | |
| SDL_Window *window = SDL_CreateWindow("Fullscreen test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_FULLSCREEN); | |
| if (!window) { | |
| fprintf(stderr, "SDL_CreateWindow failed"); | |
| SDL_Quit(); | |
| return 1; | |
| } | |
| SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0); | |
| if (!renderer) { | |
| fprintf(stderr, "SDL_CreateRenderer failed"); | |
| SDL_Quit(); | |
| return 1; | |
| } | |
| Uint8 red = 0; | |
| while (1) { | |
| SDL_Event event; | |
| while (SDL_PollEvent(&event)) { | |
| if (event.type == SDL_QUIT) { | |
| SDL_Quit(); | |
| return 1; | |
| } | |
| } | |
| SDL_SetRenderDrawColor(renderer, red++, 0, 0, 255); | |
| SDL_RenderClear(renderer); | |
| SDL_RenderPresent(renderer); | |
| SDL_Delay(10); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment