Skip to content

Commit

Permalink
initial zoom support
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Jul 24, 2024
1 parent 0c393e2 commit f2f6ffe
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions src/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,9 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
}
}

BOOL zooming = g_ddraw.zoom.enabled;
g_ddraw.zoom.enabled = FALSE;

g_ddraw.render.width = g_config.window_rect.right;
g_ddraw.render.height = g_config.window_rect.bottom;

Expand Down Expand Up @@ -665,15 +668,35 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl

}
}

if (g_ddraw.render.width < g_ddraw.width)
else if (zooming)
{
g_ddraw.render.width = g_ddraw.width;
if (g_ddraw.width > g_ddraw.mode.dmPelsWidth ||
g_ddraw.height > g_ddraw.mode.dmPelsHeight)
{
/* Downscaling requires adjmouse to be enabled */
g_config.adjmouse = TRUE;
}

/* Do not change display resolution when zooming */
g_ddraw.render.width = g_ddraw.render.mode.dmPelsWidth;
g_ddraw.render.height = g_ddraw.render.mode.dmPelsHeight;

/* Resize and alt+enter are not supported yet with zooming */
g_config.resizable = FALSE;
g_config.hotkeys.toggle_fullscreen = 0;
}

if (g_ddraw.render.height < g_ddraw.height)
if (!zooming || g_config.fullscreen)
{
g_ddraw.render.height = g_ddraw.height;
if (g_ddraw.render.width < g_ddraw.width)
{
g_ddraw.render.width = g_ddraw.width;
}

if (g_ddraw.render.height < g_ddraw.height)
{
g_ddraw.render.height = g_ddraw.height;
}
}

g_ddraw.render.run = TRUE;
Expand Down Expand Up @@ -1114,7 +1137,7 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl

if (!d3d9_active || g_config.nonexclusive)
{
if (ChangeDisplaySettings(&g_ddraw.render.mode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
if (!zooming && ChangeDisplaySettings(&g_ddraw.render.mode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
{
g_ddraw.render.run = FALSE;
g_config.windowed = TRUE;
Expand Down

0 comments on commit f2f6ffe

Please sign in to comment.