summaryrefslogtreecommitdiff
path: root/src/window.h
blob: 0c3680b728fc8f2db92a52037f278db1bd229ee3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#pragma once
#include "SDL2/SDL.h"
#include "SDL2/SDL_video.h"
#include "SDL2/SDL_render.h"


struct window {
    SDL_Renderer* renderer;
    SDL_Window* window;
};

/**
 * Get a basic SDL window up and running. This also initializes the OpenGL context, sets up a renderer and stores all the relevant data in the window struct. Memory is managed externally. We usually don't even need to free that allocated memory because it lasts till program death. 
 * @param @out window destination window pointer
 * @return 0 on success, -1 on failure
 *
 */
int window_init(struct window* window);


/**
 * Cleanup the allocated Window and quit SDL. Basically called when the user closes the window
 * 
 * @param window Window to close
 *
 */
void window_cleanup(struct window* window);