Skip to content

Commit

Permalink
Updated c_rasterizer::reset_device
Browse files Browse the repository at this point in the history
  • Loading branch information
twist84 committed Sep 28, 2024
1 parent 1022b59 commit 262c2bb
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions game/source/rasterizer/rasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,15 @@ bool __cdecl c_rasterizer::reset_device()
*presentation_parameters = *get_new_presentation_parameters();

bool fullscreen = global_preferences_get_fullscreen();
LONG window_style = fullscreen && !g_windows_params.editor_window_create ? WS_OVERLAPPED : WS_OVERLAPPEDWINDOW;
if (fullscreen && g_windows_params.editor_window_create)
global_preferences_set_fullscreen(fullscreen = false);

LONG window_style = fullscreen ? WS_OVERLAPPED : WS_OVERLAPPEDWINDOW;
if (g_windows_params.editor_window_create)
window_style &= ~(WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
SetWindowLongA(g_windows_params.game_window_handle, GWL_STYLE, window_style);

if (fullscreen && !g_windows_params.editor_window_create)
if (fullscreen)
{
ShowWindow(g_windows_params.game_window_handle, SW_MAXIMIZE);
}
Expand All @@ -426,12 +429,24 @@ bool __cdecl c_rasterizer::reset_device()

int window_x = 0;
int window_y = 0;
if (!g_windows_params.editor_window_create)
if (g_windows_params.editor_window_create)
{
if (strstr(shell_get_command_line(), "-centered") != 0)
RECT window_rect{};
GetWindowRect(g_windows_params.game_window_handle, &window_rect);
window_x = window_rect.left;
window_y = window_rect.top;
}
else
{
static bool first_run = true;
if (first_run)
{
window_x = (GetSystemMetrics(SM_CXSCREEN) - rect.right) / 2;
window_y = (GetSystemMetrics(SM_CYSCREEN) - rect.bottom) / 2;
if (strstr(shell_get_command_line(), "-centered") != 0)
{
window_x = (GetSystemMetrics(SM_CXSCREEN) - rect.right) / 2;
window_y = (GetSystemMetrics(SM_CYSCREEN) - rect.bottom) / 2;
}
first_run = false;
}
}

Expand Down

0 comments on commit 262c2bb

Please sign in to comment.