#ifndef WINDOW_H #define WINDOW_H #include "Renderer.h" #include "SDL.h" #include "SDL_pixels.h" #include #ifdef __cplusplus extern "C" { #endif // !__cplusplus typedef struct window_size { i32 width; i32 height; } WindowSize; typedef struct drawing_area { f32 x; f32 y; f32 width; f32 height; } WindowDrawingArea; typedef struct window { // We need to store the defined size because the coordinates of the mouse // cursor are calculated according to it. In the case of displays that support // high DPI, this creates a problem, because the mouse coordinates retrieved // from an SDL_Event won't work with the actual window size. By storing the // defined size of the window, this allows us to convert the mouse coordinates // to a ratio of the defined size, then multiply that ratio by the real size. WindowSize defined_size; WindowSize real_size; WindowDrawingArea drawing_area; Renderer *renderer; SDL_Window *SDL_base_window; SDL_Color background_color; bool full_screen; } Window; bool init_window(Window *wnd, const char *title, WindowSize size, SDL_Color color, bool full_screen); void clear_window(const Window *wnd); void swap_render_buffers(const Window *wnd); void destroy_window(Window *wnd); #ifdef __cplusplus } #endif // !__cplusplus #endif // !WINDOW_H