Added default window widht, height, x, and y to PLTF

This commit is contained in:
2026-07-24 21:19:59 +03:00
parent 767eeb6b39
commit 7cbb5ade05
2 changed files with 21 additions and 1 deletions

View File

@@ -3,6 +3,11 @@
#include <stdbool.h> #include <stdbool.h>
#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 { typedef enum {
PLTF_WE_NONE, PLTF_WE_NONE,
PLTF_WE_DESTROY, PLTF_WE_DESTROY,

View File

@@ -1,3 +1,4 @@
#include "pltf/pltf.h"
#ifdef _WIN32 #ifdef _WIN32
#include <GL/glcorearb.h> #include <GL/glcorearb.h>
@@ -42,6 +43,17 @@ void pltf_deinit() {
void pltf_window_create() { void pltf_window_create() {
// Create the window // 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( pltf_state.hwnd = CreateWindowEx(
0, // Optional window styles 0, // Optional window styles
pltf_state.wc_name, // Window class pltf_state.wc_name, // Window class
@@ -49,7 +61,10 @@ void pltf_window_create() {
WS_OVERLAPPEDWINDOW, // Window style WS_OVERLAPPEDWINDOW, // Window style
// Size and position // 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, // Parent window
NULL, // Menu NULL, // Menu