SDL passthrough hint and default size

This commit is contained in:
Krzosa Karol
2024-08-02 07:51:47 +02:00
parent 4cdb8a986a
commit cff301499f

View File

@@ -237,6 +237,8 @@ int main()
return 1;
}
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
const char *glsl_version = "#version 450";
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
@@ -246,6 +248,7 @@ int main()
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
Uint32 window_flags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN | SDL_WINDOW_HIGH_PIXEL_DENSITY;
SDLWindow = SDL_CreateWindow("Text editor", 1280, 720, window_flags);
if (SDLWindow == NULL) {
@@ -256,6 +259,12 @@ int main()
SDL_GLContext gl_context = SDL_GL_CreateContext(SDLWindow);
SDL_GL_MakeCurrent(SDLWindow, gl_context);
SDL_GL_SetSwapInterval(0); // Enable vsync
SDL_DisplayID display = SDL_GetDisplayForWindow(SDLWindow);
const SDL_DisplayMode *dm = SDL_GetCurrentDisplayMode(display);
SDL_SetWindowSize(SDLWindow, (int)((double)dm->w * 0.8), (int)((double)dm->h * 0.8));
SDL_SetWindowPosition(SDLWindow, (int)((double)dm->w * 0.1), (int)((double)dm->h * 0.1));
SDL_ShowWindow(SDLWindow);
// Set icon