#include #include #include #include #include "./constants.h" #include "./structs.h" int initialize_window(App* app) { if(SDL_Init(SDL_INIT_EVERYTHING) != 0) { fprintf(stderr, "Error initializing SDL.\n"); return FALSE; } app->window = SDL_CreateWindow( GAME_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_BORDERLESS ); if(!app->window) { fprintf(stderr, "Error creating SDL_Window.\n"); return FALSE; } app->renderer = SDL_CreateRenderer(app->window, -1, 0); if(!app->renderer) { fprintf(stderr, "Error creating SDL_Renderer"); return FALSE; } IMG_Init(IMG_INIT_PNG); Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024); Mix_AllocateChannels(MAX_SND_CHANNELS); return TRUE; } void destroy_window(App *app) { SDL_DestroyRenderer(app->renderer); SDL_DestroyWindow(app->window); SDL_Quit(); }