From 101e844ac5e19f8de8cfb346b232e295b5855297 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sun, 4 May 2025 09:16:34 +0200 Subject: [PATCH] window pos --- src/text_editor/text_editor.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/text_editor/text_editor.cpp b/src/text_editor/text_editor.cpp index 1d85b6e..4e92f62 100644 --- a/src/text_editor/text_editor.cpp +++ b/src/text_editor/text_editor.cpp @@ -298,12 +298,21 @@ int main(int argc, char **argv) SDL_DisplayID primary_display_id = SDL_GetPrimaryDisplay(); const SDL_DisplayMode *display_mode = SDL_GetCurrentDisplayMode(primary_display_id); + int w8 = (int)(display_mode->w * 0.8); + int h8 = (int)(display_mode->h * 0.8); + + int whalf = (int)(display_mode->w * 0.5) - 10; + int hhalf = (int)(display_mode->h) - 120; + int xhalf = whalf; + int yhalf = 30; + Uint32 window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN | SDL_WINDOW_HIGH_PIXEL_DENSITY; - SDLWindow = SDL_CreateWindow("Text editor", (int)(display_mode->w * 0.8), (int)(display_mode->h * 0.8), window_flags); + SDLWindow = SDL_CreateWindow("Text editor", whalf, hhalf, window_flags); if (SDLWindow == NULL) { ReportErrorf("Couldn't create window! %s", SDL_GetError()); return 1; } + SDL_SetWindowPosition(SDLWindow, xhalf, yhalf); SDL_GLContext gl_context = SDL_GL_CreateContext(SDLWindow); SDL_GL_MakeCurrent(SDLWindow, gl_context);