Skip to content
Snippets Groups Projects
Commit d38c1259 authored by Janos's avatar Janos
Browse files

Initialiserung des Fensters

parent 3fd1a0fb
No related branches found
No related tags found
No related merge requests found
init.c 0 → 100644
#include <SDL.h>
#include <SDL_video.h>
#include <stdbool.h>
enum screen_size {
SCREEN_WIDTH = 640,
SCREEN_HEIGHT = 480,
};
int main(int argc, char **argv) {
// Ggf. noch andere Subsyteme
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
SDL_Log("Initialisierung fehlgeschlagen! SDL_Error: %s\n", SDL_GetError());
return -1;
}
SDL_Window *window = SDL_CreateWindow("Fenster", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH,
SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
if (window == NULL) {
SDL_Log("Fenster nicht erstellt! SDL_Error: %s\n", SDL_GetError());
return -1;
}
/* Magie */
SDL_GetWindowSurface(window);
SDL_UpdateWindowSurface(window);
SDL_Event e;
bool quit = false;
while (quit == false) {
while (SDL_PollEvent(&e)) {
if (e.type == SDL_QUIT)
quit = true;
}
}
/* Magie Ende */
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment