Skip to content

Commit dd070a8

Browse files
committed
Use Import instead of Include for remaining classes
1 parent c244a77 commit dd070a8

File tree

3 files changed

+42
-45
lines changed

3 files changed

+42
-45
lines changed

Bender.bmx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@ EndRem
99
SuperStrict
1010

1111
Import "EmbeddedAssets.bmx"
12-
Import "Types/Utility.bmx"
1312
Import "Types/UserInterface.bmx"
1413
Import "Types/FileIO.bmx"
15-
16-
Include "Types/SettingsManager.bmx"
17-
Include "Types/GraphicsOutput.bmx"
14+
Import "Types/GraphicsOutput.bmx"
1815

1916
'//// MAIN LOOP AND EVENT HANDLING //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2017

@@ -30,7 +27,6 @@ Repeat
3027
g_UserInterface = New UserInterface(g_DefaultInputZoom, g_DefaultFrameCount, g_DefaultBackgroundRed, g_DefaultBackgroundGreen, g_DefaultBackgroundBlue)
3128
g_FileIO = New FileIO()
3229
g_GraphicsOutput = New GraphicsOutput()
33-
g_GraphicsOutput.InitializeGraphicsOutput()
3430

3531
Repeat
3632
PollEvent()

types/GraphicsOutput.bmx

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,58 @@
1-
Include "LimbManager.bmx"
1+
Import "SettingsManager.bmx"
2+
Import "LimbManager.bmx"
23

34
'//// GRAPHICS OUTPUT ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
45

56
Type GraphicsOutput
67
'Draw Bools
7-
Global m_RedoLimbTiles:Int = False
8+
Field m_RedoLimbTiles:Int = False
89
'Constants
910
Const c_MaxZoom:Int = 11
1011
Const c_MaxFrameCount:Int = 20
11-
Global c_Magenta:Int[] = [255, 0, 255]
12+
Field c_Magenta:Int[] = [255, 0, 255]
1213
'Graphic Assets
13-
Global m_SourceImage:TImage
14-
Global m_SourceImageSize:Svec2I
14+
Field m_SourceImage:TImage
15+
Field m_SourceImageSize:Svec2I
1516
'Output Settings
16-
Global m_InputZoom:Int = g_DefaultInputZoom
17-
Global m_TileSize:Int = 24 * m_InputZoom
18-
Global m_FrameCount:Int = g_DefaultFrameCount
19-
Global m_BackgroundColor:Int[] = [g_DefaultBackgroundRed, g_DefaultBackgroundGreen, g_DefaultBackgroundBlue]
17+
Field m_InputZoom:Int = g_DefaultInputZoom
18+
Field m_TileSize:Int = 24 * m_InputZoom
19+
Field m_FrameCount:Int = g_DefaultFrameCount
20+
Field m_BackgroundColor:Int[] = [g_DefaultBackgroundRed, g_DefaultBackgroundGreen, g_DefaultBackgroundBlue]
2021

21-
Global m_DrawOutputFrameBounds:Int
22+
Field m_DrawOutputFrameBounds:Int
2223

23-
Global m_LimbManager:LimbManager = New LimbManager()
24+
Field m_LimbManager:LimbManager = New LimbManager()
2425

2526
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2627

27-
Function InitializeGraphicsOutput()
28+
Method New()
2829
SetClsColor(m_BackgroundColor[0], m_BackgroundColor[1], m_BackgroundColor[2])
2930
SetMaskColor(c_Magenta[0], c_Magenta[1], c_Magenta[2])
30-
EndFunction
31+
EndMethod
3132

3233
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3334

34-
Function LoadFile(fileToLoad:String)
35+
Method LoadFile(fileToLoad:String)
3536
m_SourceImage = LoadImage(fileToLoad, 0)
3637

3738
If m_SourceImage <> Null Then
3839
m_SourceImageSize = New SVec2I(ImageWidth(m_SourceImage), ImageHeight(m_SourceImage))
3940
DrawImageRect(m_SourceImage, 0, 0, m_SourceImageSize[0] * m_InputZoom, m_SourceImageSize[1] * m_InputZoom) 'Draw the source image to the backbuffer so limb tiles can be created
4041
m_LimbManager.CreateLimbParts(m_InputZoom, m_TileSize)
4142
EndIf
42-
EndFunction
43+
EndMethod
4344

4445
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
4546

46-
Function SetBackgroundColor:Int[](rgbValue:Int[])
47+
Method SetBackgroundColor:Int[](rgbValue:Int[])
4748
m_BackgroundColor = rgbValue
4849
ChangeBackgroundColor(m_BackgroundColor)
4950
Return m_BackgroundColor
50-
EndFunction
51+
EndMethod
5152

5253
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5354

54-
Function SetInputZoom:Int(newZoom:Int)
55+
Method SetInputZoom:Int(newZoom:Int)
5556
Local clampedNewZoom:Int = Utility.Clamp(newZoom, 1, c_MaxZoom)
5657
If m_InputZoom <> clampedNewZoom Then
5758
m_InputZoom = clampedNewZoom
@@ -60,30 +61,30 @@ Type GraphicsOutput
6061
m_LimbManager.CreateLimbParts(m_InputZoom, m_TileSize)
6162
EndIf
6263
Return m_InputZoom
63-
EndFunction
64+
EndMethod
6465

6566
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
6667

67-
Function SetFrameCount:Int(newCount:Int)
68+
Method SetFrameCount:Int(newCount:Int)
6869
m_FrameCount = Utility.Clamp(newCount, 1, c_MaxFrameCount)
6970
Return m_FrameCount
70-
EndFunction
71+
EndMethod
7172

7273
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7374

74-
Function ChangeBackgroundColor(rgbValue:Int[])
75+
Method ChangeBackgroundColor(rgbValue:Int[])
7576
SetClsColor(rgbValue[0], rgbValue[1], rgbValue[2])
76-
EndFunction
77+
EndMethod
7778

7879
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7980

80-
Function SetDrawOutputFrameBounds(drawOrNot:Int)
81+
Method SetDrawOutputFrameBounds(drawOrNot:Int)
8182
m_DrawOutputFrameBounds = drawOrNot
82-
EndFunction
83+
EndMethod
8384

8485
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8586

86-
Function Update()
87+
Method Update()
8788
'Left mouse to adjust joint markers, click or hold and drag
8889
If MouseDown(1) Then
8990
Local mousePos:SVec2I = New SVec2I(MouseX(), MouseY())
@@ -92,11 +93,11 @@ Type GraphicsOutput
9293
EndIf
9394
EndIf
9495
ChangeBackgroundColor(m_BackgroundColor)
95-
EndFunction
96+
EndMethod
9697

9798
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
9899

99-
Function Draw()
100+
Method Draw()
100101
If m_SourceImage = Null Then
101102
DrawNoSourceImageScreen()
102103
Else
@@ -131,11 +132,11 @@ Type GraphicsOutput
131132
EndIf
132133
Flip(1)
133134
EndIf
134-
EndFunction
135+
EndMethod
135136

136137
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
137138

138-
Function GrabOutputForSaving()
139+
Method GrabOutputForSaving()
139140
Rem
140141
141142
If m_SourceImage = Null Then
@@ -165,17 +166,17 @@ Type GraphicsOutput
165166
EndIf
166167
167168
EndRem
168-
EndFunction
169+
EndMethod
169170

170171
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
171172

172-
Function DrawNoSourceImageScreen()
173+
Method DrawNoSourceImageScreen()
173174
Cls()
174175
SetScale(2, 2)
175176
Local textToDraw:String = "NO IMAGE LOADED!"
176177
Local drawColor:Int[] = [255, 230, 80]
177178
Utility.DrawTextWithShadow(textToDraw, New SVec2I((GraphicsWidth() / 2) - TextWidth(textToDraw), (GraphicsHeight() / 2) - TextHeight(textToDraw)), drawColor)
178179
SetScale(1, 1)
179180
Flip(1)
180-
EndFunction
181+
EndMethod
181182
EndType

types/LimbManager.bmx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Include "Utility.bmx"
2-
Include "JointMarker.bmx"
1+
Import "Utility.bmx"
2+
Import "JointMarker.bmx"
33

44
'//// LIMB MANAGER //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
55

@@ -17,13 +17,13 @@ Type LimbManager
1717
Field m_LimbPartTilePos:SVec2I[c_LimbPartCount]
1818
Field m_LimbPartImage:TImage[c_LimbPartCount]
1919
Field m_LimbPartLength:Float[c_LimbPartCount]
20-
Global m_LimbPartAngle:Int[c_LimbPartCount, 20]
21-
Global m_LimbPartPosX:Int[c_LimbPartCount, 20]
22-
Global m_LimbPartPosY:Int[c_LimbPartCount, 20]
20+
Field m_LimbPartAngle:Int[c_LimbPartCount, 20]
21+
Field m_LimbPartPosX:Int[c_LimbPartCount, 20]
22+
Field m_LimbPartPosY:Int[c_LimbPartCount, 20]
2323

24-
Global m_JointMarkers:JointMarker[c_JointMarkerCount]
24+
Field m_JointMarkers:JointMarker[c_JointMarkerCount]
2525

26-
Global m_DrawJointMarkerBounds:Int[] = Null
26+
Field m_DrawJointMarkerBounds:Int[] = Null
2727

2828
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2929

0 commit comments

Comments
 (0)