Added support for desktop full screen with pillarboxing and letterboxing

and started adding some comments to the code
This commit is contained in:
abdelrahman committed 2022-10-02 02:16:28 +01:00
1 parent ffaa6e5ae7
commit e110b1f2fd
10 files changed
+351 -77

No files matched your search

+16 -1
View File
@@ -16,12 +16,27 @@ typedef struct window_size {
int32_t height;
} WindowSize;
typedef struct drawing_area {
float x;
float y;
float width;
float 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 drawable_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,