window pos
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user