Skip to content

Commit ec86395

Browse files
committed
Draw frame bounding boxes with primitives instead of image
1 parent e8239b5 commit ec86395

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

Assets/Tile

-1.84 KB
Binary file not shown.

EmbeddedAssets.bmx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'File assets to be embedded into the executable
22
Incbin "Assets/Logo"
33
Incbin "Assets/Palette"
4-
Incbin "Assets/Tile"
54
Incbin "Assets/TextAbout"
65
Incbin "Assets/TextHelp"

types/GraphicsOutput.bmx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ Type GraphicsOutput
1212
Field c_Magenta:Int[] = [255, 0, 255]
1313
'Graphic Assets
1414
Field m_SourceImage:TImage
15-
Field m_SourceImageSize:Svec2I
15+
Field m_SourceImageSize:SVec2I
1616
'Output Settings
1717
Field m_InputZoom:Int = g_DefaultInputZoom
1818
Field m_TileSize:Int = 24 * m_InputZoom
1919
Field m_FrameCount:Int = g_DefaultFrameCount
2020
Field m_BackgroundColor:Int[] = [g_DefaultBackgroundRed, g_DefaultBackgroundGreen, g_DefaultBackgroundBlue]
2121

2222
Field m_DrawOutputFrameBounds:Int
23+
Field m_FrameBoundingBoxPosX:Int[c_LimbCount, c_MaxFrameCount]
24+
Field m_FrameBoundingBoxPosY:Int[c_LimbCount, c_MaxFrameCount]
25+
Field m_FrameBoundingBoxSize:SVec2I
2326

2427
Field m_LimbManager:LimbManager = New LimbManager()
2528

@@ -124,22 +127,23 @@ Type GraphicsOutput
124127
m_LimbManager.DrawTileOutlines()
125128
m_LimbManager.DrawJointMarkers()
126129

127-
Local vertOffsetFromSource:Int = (m_SourceImageSize[1] * m_InputZoom) + 35
130+
Local vertOffsetFromSource:Int = (m_SourceImageSize[1] * m_InputZoom) + 34
128131
m_LimbManager.DrawBentLimbs(New SVec2I(100, vertOffsetFromSource), m_FrameCount)
129132

130133
Local drawColor:Int[] = [255, 230, 80]
131134
Utility.DrawTextWithShadow("Arm FG", New SVec2I(10, vertOffsetFromSource), drawColor)
132-
Utility.DrawTextWithShadow("Arm BG", New SVec2I(10, vertOffsetFromSource + 48), drawColor)
133-
Utility.DrawTextWithShadow("Leg FG", New SVec2I(10, vertOffsetFromSource + (48 * 2)), drawColor)
134-
Utility.DrawTextWithShadow("Leg BG", New SVec2I(10, vertOffsetFromSource + (48 * 3)), drawColor)
135+
Utility.DrawTextWithShadow("Arm BG", New SVec2I(10, vertOffsetFromSource + 50 - 2), drawColor)
136+
Utility.DrawTextWithShadow("Leg FG", New SVec2I(10, vertOffsetFromSource + (50 * 2) - 4), drawColor)
137+
Utility.DrawTextWithShadow("Leg BG", New SVec2I(10, vertOffsetFromSource + (50 * 3) - 6), drawColor)
135138

136139
If m_DrawOutputFrameBounds Then
137-
For Local row:Int = 0 To 3
138-
For Local frame:Int = 0 To m_FrameCount - 1
139-
Local tile:TImage = LoadImage("Incbin::Assets/Tile")
140-
141-
'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.
142-
DrawImage(tile, 62 + (frame * (m_TileSize / m_InputZoom + 8)), 138 + (row * 48))
140+
drawColor = [0, 0, 80]
141+
m_FrameBoundingBoxSize = New SVec2I(32, 48)
142+
For Local row:Int = 0 Until c_LimbCount
143+
For Local frame:Int = 0 Until m_FrameCount
144+
m_FrameBoundingBoxPosX[row, frame] = 100 - 20 + (frame * (m_TileSize / m_InputZoom + 8))
145+
m_FrameBoundingBoxPosY[row, frame] = vertOffsetFromSource - 12 + (row * 48)
146+
Utility.DrawRectOutline(New SVec2I(m_FrameBoundingBoxPosX[row, frame], m_FrameBoundingBoxPosY[row, frame]), m_FrameBoundingBoxSize, drawColor)
143147
Next
144148
Next
145149
EndIf

0 commit comments

Comments
 (0)