Skip to content

Commit edac57c

Browse files
committed
Determine max input zoom from desktop width
1 parent 0a2d2a0 commit edac57c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Bender.bmx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Global g_GraphicsOutput:GraphicsOutput
2626
Repeat
2727
g_UserInterface = New UserInterface(g_DefaultInputZoom, g_DefaultFrameCount, g_DefaultBackgroundRed, g_DefaultBackgroundGreen, g_DefaultBackgroundBlue)
2828
g_FileIO = New FileIO()
29-
g_GraphicsOutput = New GraphicsOutput()
29+
g_GraphicsOutput = New GraphicsOutput(g_UserInterface.GetMaxWorkspaceWidth())
3030
EnablePolledInput()
3131

3232
Repeat

types/GraphicsOutput.bmx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Type GraphicsOutput
1111
Const c_MaxFrameCount:Int = 20
1212
Field c_Magenta:Int[] = [255, 0, 255]
1313
'Graphic Assets
14+
15+
Field m_MaxZoom:Int = 5 'Assume 1366px is the lowest resolution because it's not 1999. 1366px - 260px (left column) = 1106 / 192 (source image width) = 5 (floored)
1416
Field m_SourceImage:TImage
1517
Field m_SourceImageSize:SVec2I
1618
'Output Settings
@@ -28,9 +30,11 @@ Type GraphicsOutput
2830

2931
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3032

31-
Method New()
33+
Method New(maxWorkspaceWidth:Int)
3234
SetClsColor(m_BackgroundColor[0], m_BackgroundColor[1], m_BackgroundColor[2])
3335
SetMaskColor(c_Magenta[0], c_Magenta[1], c_Magenta[2])
36+
37+
m_MaxZoom = Int(FloorF(maxWorkspaceWidth / 192))
3438
EndMethod
3539

3640
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -56,7 +60,7 @@ Type GraphicsOutput
5660
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5761

5862
Method SetInputZoom:Int(newZoom:Int)
59-
Local clampedNewZoom:Int = Utility.Clamp(newZoom, 1, c_MaxZoom)
63+
Local clampedNewZoom:Int = Utility.Clamp(newZoom, 1, m_MaxZoom)
6064
If m_InputZoom <> clampedNewZoom Then
6165
m_InputZoom = clampedNewZoom
6266
m_TileSize = 24 * m_InputZoom

0 commit comments

Comments
 (0)