Skip to content

Commit c244a77

Browse files
committed
Temporarily disable GrabOutputForSaving and changes to drawing
1 parent 9eec4bc commit c244a77

File tree

4 files changed

+36
-21
lines changed

4 files changed

+36
-21
lines changed

Bender.bmx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Repeat
7171
g_UserInterface.SetColorTextboxValues(g_GraphicsOutput.SetBackgroundColor(g_UserInterface.GetColorTextboxValues()))
7272
'Save as Frames
7373
Case g_UserInterface.m_SettingsSaveAsFramesCheckbox
74-
g_FileIO.SetSaveAsFrames(ButtonState(g_UserInterface.m_SettingsSaveAsFramesCheckbox))
74+
g_GraphicsOutput.SetDrawOutputFrameBounds(g_FileIO.SetSaveAsFrames(ButtonState(g_UserInterface.m_SettingsSaveAsFramesCheckbox)))
7575
'Save as Indexed
7676
Case g_UserInterface.m_SettingsIndexedCheckbox
7777
g_FileIO.SetSaveAsIndexed(ButtonState(g_UserInterface.m_SettingsIndexedCheckbox))

types/FileIO.bmx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ Type FileIO
4040

4141
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4242

43-
Method SetSaveAsFrames(framesOrNot:Int)
43+
Method SetSaveAsFrames:Int(framesOrNot:Int)
4444
m_SaveAsFrames = framesOrNot
45+
Return m_SaveAsFrames
4546
EndMethod
4647

4748
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

types/GraphicsOutput.bmx

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Type GraphicsOutput
1818
Global m_FrameCount:Int = g_DefaultFrameCount
1919
Global m_BackgroundColor:Int[] = [g_DefaultBackgroundRed, g_DefaultBackgroundGreen, g_DefaultBackgroundBlue]
2020

21-
Global m_PrepForSave:Int
21+
Global m_DrawOutputFrameBounds:Int
2222

2323
Global m_LimbManager:LimbManager = New LimbManager()
2424

@@ -27,7 +27,6 @@ Type GraphicsOutput
2727
Function InitializeGraphicsOutput()
2828
SetClsColor(m_BackgroundColor[0], m_BackgroundColor[1], m_BackgroundColor[2])
2929
SetMaskColor(c_Magenta[0], c_Magenta[1], c_Magenta[2])
30-
DrawNoSourceImageScreen()
3130
EndFunction
3231

3332
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -76,6 +75,12 @@ Type GraphicsOutput
7675
SetClsColor(rgbValue[0], rgbValue[1], rgbValue[2])
7776
EndFunction
7877

78+
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
79+
80+
Function SetDrawOutputFrameBounds(drawOrNot:Int)
81+
m_DrawOutputFrameBounds = drawOrNot
82+
EndFunction
83+
7984
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8085

8186
Function Update()
@@ -86,18 +91,15 @@ Type GraphicsOutput
8691
m_LimbManager.SetJointMarker(mousePos)
8792
EndIf
8893
EndIf
89-
90-
If m_PrepForSave
91-
ChangeBackgroundColor(c_Magenta)
92-
Else
93-
ChangeBackgroundColor(m_BackgroundColor)
94-
EndIf
94+
ChangeBackgroundColor(m_BackgroundColor)
9595
EndFunction
9696

9797
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9898

9999
Function Draw()
100-
If m_SourceImage <> Null Then
100+
If m_SourceImage = Null Then
101+
DrawNoSourceImageScreen()
102+
Else
101103
Cls()
102104

103105
SetColor(c_Magenta[0], c_Magenta[1], c_Magenta[2])
@@ -117,27 +119,37 @@ Type GraphicsOutput
117119
Utility.DrawTextWithShadow("Leg FG", New SVec2I(10, vertOffsetFromSource + (48 * 2)), drawColor)
118120
Utility.DrawTextWithShadow("Leg BG", New SVec2I(10, vertOffsetFromSource + (48 * 3)), drawColor)
119121

122+
If m_DrawOutputFrameBounds = True Then
123+
For Local row:Int = 0 To 3
124+
For Local frame:Int = 0 To m_FrameCount - 1
125+
Local tile:TImage = LoadImage("Incbin::Assets/Tile")
126+
127+
'Doing this with an image because cba doing the math with DrawLine. Offsets are -1px because tile image is 26x26 for outline and tile is 24x24.
128+
DrawImage(tile, 62 + (frame * (m_TileSize / m_InputZoom + 8)), 138 + (row * 48))
129+
Next
130+
Next
131+
EndIf
120132
Flip(1)
121133
EndIf
122134
EndFunction
123135

124136
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
125137

126138
Function GrabOutputForSaving()
139+
Rem
140+
127141
If m_SourceImage = Null Then
128142
Notify("Nothing to save!", False)
129143
Else
130-
m_PrepForSave = True
144+
ChangeBackgroundColor(c_Magenta)
145+
Draw()
131146
132147
If Not g_FileIO.m_SaveAsFrames Then
133148
g_FileIO.SaveFile(GrabPixmap(55, 120, 34 * m_FrameCount, 210))
134149
Else
135150
Local framesToSave:TPixmap[c_LimbCount, m_FrameCount]
136-
Local tile:TImage = LoadImage("Incbin::Assets/Tile")
137151
For Local row:Int = 0 To 3
138152
For Local frame:Int = 0 To m_FrameCount - 1
139-
'Draw a tile outline around all frames to see we are within bounds
140-
DrawImage(tile, 62 + (frame * (m_TileSize / m_InputZoom + 8)), 138 + (row * 48)) 'Doing this with an image because cba doing the math with DrawLine. Offsets are -1px because tile image is 26x26 for outline and tile is 24x24.
141153
'Grab pixmap inside tile bounds for saving
142154
framesToSave[row, frame] = GrabPixmap(63 + (frame * (m_TileSize / m_InputZoom + 8)), 139 + (row * 48), m_TileSize / m_InputZoom, m_TileSize / m_InputZoom)
143155
'HFlip the legs so they're facing right
@@ -148,9 +160,11 @@ Type GraphicsOutput
148160
Next
149161
g_FileIO.SaveFileAsFrames(framesToSave, m_FrameCount)
150162
EndIf
151-
Flip(1)
163+
164+
ChangeBackgroundColor(m_BackgroundColor)
152165
EndIf
153-
m_PrepForSave = False
166+
167+
EndRem
154168
EndFunction
155169

156170
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

types/LimbManager.bmx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ Type LimbManager
5757
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5858

5959
Method LawOfCosines:Float[](ab:Float, bc:Float, ca:Float)
60-
Local angleA:Float = ACos((ca ^ 2 + ab ^ 2 - bc ^ 2) / (2 * ca * ab))
61-
Local angleB:Float = ACos(( bc ^ 2 + ab ^ 2 - ca ^ 2) / (2 * bc * ab))
62-
Local angleC:Float = (180 - (angleA + angleB))
63-
Local result:Float[] = [angleA, angleB, angleC]
60+
Local result:Float[] = [0, 0, 0]
61+
result[0] = ACos((ca ^ 2 + ab ^ 2 - bc ^ 2) / (2 * ca * ab))
62+
result[1] = ACos(( bc ^ 2 + ab ^ 2 - ca ^ 2) / (2 * bc * ab))
63+
result[2] = (180 - (result[0] + result[1]))
6464
Return result
6565
EndMethod
6666

0 commit comments

Comments
 (0)