Skip to content

Commit 61584c8

Browse files
committed
Add output zoom
1 parent ef58dfd commit 61584c8

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

Bender.bmx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Repeat
6868
g_UserInterface.SetInputZoomTextboxValue(g_GraphicsOutput.SetInputZoom(g_UserInterface.GetInputZoomTextboxValue()))
6969
'Output Scale
7070
Case g_UserInterface.m_SettingsOutputZoomTextbox
71-
g_UserInterface.SetOutputZoomTextboxValue(g_UserInterface.GetOutputZoomTextboxValue())
71+
g_UserInterface.SetOutputZoomTextboxValue(g_GraphicsOutput.SetOutputZoom(g_UserInterface.GetOutputZoomTextboxValue()))
7272
'Frames
7373
Case g_UserInterface.m_SettingsFramesTextbox
7474
g_UserInterface.SetFramesTextboxValue(g_GraphicsOutput.SetFrameCount(g_UserInterface.GetFramesTextboxValue()))

Types/GraphicsOutput.bmx

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Type GraphicsOutput
1313
Field m_SourceImageSize:SVec2I = Null
1414

1515
Field m_InputZoom:Int = g_DefaultInputZoom
16+
Field m_OutputZoom:Int = g_DefaultOutputZoom
1617
Field m_TileSize:Int = 24 * m_InputZoom
1718
Field m_FrameCount:Int = g_DefaultFrameCount
1819
Field m_BackgroundColor:Int[] = [g_DefaultBackgroundRed, g_DefaultBackgroundGreen, g_DefaultBackgroundBlue]
@@ -72,6 +73,13 @@ Type GraphicsOutput
7273
Return m_InputZoom
7374
EndMethod
7475

76+
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
77+
78+
Method SetOutputZoom:Int(newZoom:Int)
79+
m_OutputZoom = Utility.Clamp(newZoom, 1, 5)
80+
Return m_OutputZoom
81+
EndMethod
82+
7583
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7684

7785
Method SetBackgroundColor:Int[](rgbValue:Int[])
@@ -197,14 +205,6 @@ Type GraphicsOutput
197205
Local vertOffsetFromSource:Int = (m_SourceImageSize[1] * m_InputZoom) + 34
198206
m_LimbManager.DrawBentLimbs(New SVec2I(100, vertOffsetFromSource), m_FrameCount, m_BentLimbPartDrawOrder)
199207

200-
SetColor(m_Magenta[0], m_Magenta[1], m_Magenta[2])
201-
DrawRect(0, 0, GraphicsWidth(), (m_SourceImageSize[1] * m_InputZoom) + 1) 'Extend the source image magenta strip all the way to the right and adjust height to input zoom
202-
Utility.ResetDrawColor()
203-
DrawImageRect(m_SourceImage, 0, 0, m_SourceImageSize[0] * m_InputZoom, m_SourceImageSize[1] * m_InputZoom)
204-
205-
m_LimbManager.DrawTileOutlines()
206-
m_LimbManager.DrawJointMarkers()
207-
208208
Local drawColor:Int[] = [255, 230, 80]
209209
Utility.DrawTextWithShadow("Arm FG", New SVec2I(10, vertOffsetFromSource), drawColor)
210210
Utility.DrawTextWithShadow("Arm BG", New SVec2I(10, vertOffsetFromSource + 50 - 2), drawColor)
@@ -222,6 +222,21 @@ Type GraphicsOutput
222222
Next
223223
Next
224224
EndIf
225+
226+
If m_OutputZoom > 1 Then
227+
Local outputCopyForZoom:TImage = CreateImage(100 + (m_FrameCount * ((m_TileSize / m_InputZoom) + 8)), 230, 1, DYNAMICIMAGE)
228+
GrabImage(outputCopyForZoom, 0, m_SourceImageSize[1] * m_InputZoom)
229+
DrawImageRect(outputCopyForZoom, 0, m_SourceImageSize[1] * m_InputZoom, outputCopyForZoom.Width * m_OutputZoom, outputCopyForZoom.Height * m_OutputZoom)
230+
EndIf
231+
232+
SetColor(m_Magenta[0], m_Magenta[1], m_Magenta[2])
233+
DrawRect(0, 0, GraphicsWidth(), (m_SourceImageSize[1] * m_InputZoom) + 1) 'Extend the source image magenta strip all the way to the right and adjust height to input zoom
234+
Utility.ResetDrawColor()
235+
DrawImageRect(m_SourceImage, 0, 0, m_SourceImageSize[0] * m_InputZoom, m_SourceImageSize[1] * m_InputZoom)
236+
237+
m_LimbManager.DrawTileOutlines()
238+
m_LimbManager.DrawJointMarkers()
239+
225240
Flip(1)
226241
EndIf
227242
EndMethod

0 commit comments

Comments
 (0)