How to create an empty window using SDL2 in C

1 Answer

0 votes
#include <stdio.h>
#include <SDL.h>

int main(int argc, char* argv[]) {
    if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
        printf("SDL_Init Error: %s\n", SDL_GetError());
    }

    SDL_Window* win = SDL_CreateWindow("SDL",
                                        SDL_WINDOWPOS_CENTERED,
                                        SDL_WINDOWPOS_CENTERED,
                                        800, 800, 0);
    
    int close = 0;

    while (!close) {
        SDL_Event event;
        while (SDL_PollEvent(&event)) {
            switch (event.type) {

            case SDL_QUIT:
                close = 1;
                break;
            }
        }
    }

    SDL_Quit();

	return 0;
}

 



answered Jan 1, 2022 by avibootz
edited Jan 2, 2022 by avibootz

Related questions

...