From ff549f22682b81d0ed859510173e728dac09b8b9 Mon Sep 17 00:00:00 2001 From: xengineering Date: Mon, 23 Jan 2023 20:58:26 +0100 Subject: gui.c: Remove inline comments Not that helpful. Should be replaced by easy to read code and well written function docstrings. --- gui.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/gui.c b/gui.c index 1c107da..1b3606e 100644 --- a/gui.c +++ b/gui.c @@ -49,6 +49,13 @@ struct GuiContext *init() { } void deinit(struct GuiContext *ctx) { + + // TODO this seems to end in memory access errors but ... why? + //SDL_DestroyTexture(texture); + //SDL_DestroyRenderer(renderer); + + SDL_Quit(); + free(ctx->pixels); free(ctx); } @@ -57,22 +64,18 @@ void gui_run(void) { struct GuiContext *ctx = init(); - // init SDL2 and create window SDL_Init(SDL_INIT_VIDEO); ctx->window = SDL_CreateWindow("LimoX", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE ); - // output video driver to stderr fprintf(stderr, "SDL2 video driver: %s\n", SDL_GetCurrentVideoDriver()); - // create and initialize renderer, texture and pixel buffer ctx->renderer = SDL_CreateRenderer(ctx->window, -1, 0); ctx->texture = SDL_CreateTexture(ctx->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, 640, 480); - // handle failed window creation if (ctx->window == NULL) { fprintf(stderr, "Failed to create SDL2 window!\n"); return; @@ -103,10 +106,4 @@ void gui_run(void) { deinit(ctx); - // TODO this seems to end in memory access errors but ... why? - //SDL_DestroyTexture(texture); - //SDL_DestroyRenderer(renderer); - - SDL_Quit(); - } -- cgit v1.2.3-70-g09d2