From 7cbb5ade0502aad75405cc577ebc1d2899f04daf Mon Sep 17 00:00:00 2001 From: Aaro Saila Date: Fri, 24 Jul 2026 21:19:59 +0300 Subject: [PATCH] Added default window widht, height, x, and y to PLTF --- src/pltf/pltf.h | 5 +++++ src/pltf/win32/pltf.c | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/pltf/pltf.h b/src/pltf/pltf.h index 4457c6d..d0682ed 100644 --- a/src/pltf/pltf.h +++ b/src/pltf/pltf.h @@ -3,6 +3,11 @@ #include +#define PLTF_DEFAULT_WINDOW_WIDTH 1280 +#define PLTF_DEFAULT_WINDOW_HEIGHT 720 +#define PLTF_DEFAULT_WINDOW_X 0 +#define PLTF_DEFAULT_WINDOW_Y 0 + typedef enum { PLTF_WE_NONE, PLTF_WE_DESTROY, diff --git a/src/pltf/win32/pltf.c b/src/pltf/win32/pltf.c index eeb2970..486a08e 100644 --- a/src/pltf/win32/pltf.c +++ b/src/pltf/win32/pltf.c @@ -1,3 +1,4 @@ +#include "pltf/pltf.h" #ifdef _WIN32 #include @@ -42,6 +43,17 @@ void pltf_deinit() { void pltf_window_create() { // Create the window + DWORD window_style = WS_OVERLAPPEDWINDOW; + RECT window_size_rect = (RECT) { + .left = 0, + .top = 0, + .right = PLTF_DEFAULT_WINDOW_WIDTH, + .bottom = PLTF_DEFAULT_WINDOW_HEIGHT + }; + if (!AdjustWindowRectEx(&window_size_rect, window_style, false, 0)) { + LOG_FATAL("Failed to adjust window size\n"); + } + printf("Adjuested:\nright: %ld\nbottom: %ld\n", window_size_rect.right, window_size_rect.bottom); pltf_state.hwnd = CreateWindowEx( 0, // Optional window styles pltf_state.wc_name, // Window class @@ -49,7 +61,10 @@ void pltf_window_create() { WS_OVERLAPPEDWINDOW, // Window style // Size and position - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + PLTF_DEFAULT_WINDOW_X, + PLTF_DEFAULT_WINDOW_Y, + PLTF_DEFAULT_WINDOW_WIDTH, + PLTF_DEFAULT_WINDOW_HEIGHT, NULL, // Parent window NULL, // Menu