Skip to content

Commit 48044be

Browse files
committed
Refactor
Move types into individual files Include types in main Update gitignore
1 parent 7d48ac9 commit 48044be

File tree

9 files changed

+729
-721
lines changed

9 files changed

+729
-721
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/.bmx
2-
cccp-bender-main.bmx.bak
3-
cccp-bender-main.exe
4-
cccp-bender-main.debug.exe
2+
*.exe
3+
*.bak

assets.bmx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Rem
2+
------- ASSETS --------------------------------------------------------------------------------------------------------
3+
EndRem
4+
5+
'Embed palette file for standalone exe
6+
Incbin "assets/palette.act"
7+
8+
'Embed logo image for standalone exe
9+
Incbin "assets/logo-image"

bender.bmx

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
Rem
2+
------- CORTEX COMMAND COMMUNITY PROJECT BENDER -----------------------------------------------------------------------
3+
EndRem
4+
5+
SuperStrict
6+
7+
'Import dependencies into build
8+
Import MaxGUI.Drivers
9+
Import BRL.Max2D
10+
Import BRL.Pixmap
11+
Import BRL.PNGLoader
12+
Import BRL.Stream
13+
Import BRL.EndianStream
14+
15+
'Load assets
16+
Include "assets.bmx"
17+
18+
'Include individual types
19+
Include "types/user-interface.bmx"
20+
Include "types/editor-output.bmx"
21+
Include "types/file-io.bmx"
22+
Include "types/bitmap-index.bmx"
23+
24+
'Version
25+
Global appVersion:String = "1.2.1"
26+
Global appVersionDate:String = "22 Sep 2019"
27+
28+
Rem
29+
------- BOOT ----------------------------------------------------------------------------------------------------------
30+
EndRem
31+
32+
New TAppGUI
33+
New TAppOutput
34+
New TAppFileIO
35+
New TBitmapIndex
36+
TAppGUI.FAppMain()
37+
38+
Rem
39+
------- EVENT HANDLING ------------------------------------------------------------------------------------------------
40+
EndRem
41+
42+
While True
43+
If Not TAppGUI.mainToEdit Then
44+
TAppGUI.FAppUpdate()
45+
Else
46+
TAppOutput.FOutputUpdate()
47+
If ButtonState(TAppGUI.editSettingsIndexedCheckbox) = True Then
48+
fileFilters = "Image Files:bmp"
49+
TAppFileIO.saveAsIndexed = True
50+
Else
51+
fileFilters = "Image Files:png"
52+
TAppFileIO.saveAsIndexed = False
53+
EndIf
54+
EndIf
55+
56+
WaitEvent
57+
'Print CurrentEvent.ToString()
58+
'Print GCMemAlloced()
59+
60+
'Event Responses
61+
'In Main Window
62+
If Not TAppGUI.mainToEdit Then
63+
Select EventID()
64+
Case EVENT_GADGETACTION
65+
Select EventSource()
66+
'Quitting
67+
Case TAppGUI.mainQuitButton
68+
Exit
69+
'Loading
70+
Case TAppGUI.mainLoadButton
71+
TAppFileIO.FLoadFile()
72+
EndSelect
73+
'Quitting
74+
Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
75+
Exit
76+
EndSelect
77+
'In Editor Window
78+
ElseIf TAppGUI.mainToEdit Then
79+
Select EventID()
80+
Case EVENT_APPRESUME
81+
ActivateWindow(TAppGUI.editWindow)
82+
TAppOutput.FOutputUpdate()
83+
Case EVENT_WINDOWACTIVATE
84+
TAppOutput.FOutputUpdate()
85+
Case EVENT_GADGETLOSTFOCUS
86+
TAppOutput.FOutputUpdate()
87+
Case EVENT_GADGETACTION
88+
Select EventSource()
89+
'Quitting confirm
90+
Case TAppGUI.editQuitButton
91+
quitResult = Confirm("Quit program?")
92+
'Loading
93+
Case TAppGUI.editLoadButton
94+
TAppFileIO.FLoadFile()
95+
TAppOutput.FOutputUpdate()
96+
'Saving
97+
Case TAppGUI.editSaveButton
98+
TAppFileIO.prepForSave = True
99+
TAppOutput.FOutputUpdate()
100+
'Settings textbox inputs
101+
'Scale
102+
Case TAppGUI.editSettingsZoomTextbox
103+
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsZoomTextbox).ToInt()
104+
'Foolproofing
105+
If userInputValue > 4 Then
106+
TAppOutput.INPUTZOOM = 4
107+
ElseIf userInputValue <= 0 Then
108+
TAppOutput.INPUTZOOM = 1
109+
Else
110+
TAppOutput.INPUTZOOM = userInputValue
111+
EndIf
112+
SetGadgetText(TAppGUI.editSettingsZoomTextbox,TAppOutput.INPUTZOOM)
113+
TAppOutput.TILESIZE = 24 * TAppOutput.INPUTZOOM
114+
TAppOutput.redoLimbTiles = True
115+
TAppOutput.FOutputUpdate()
116+
'Frames
117+
Case TAppGUI.editSettingsFramesTextbox
118+
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsFramesTextbox).ToInt()
119+
'Foolproofing
120+
If userInputValue > 20 Then
121+
TAppOutput.FRAMES = 20
122+
ElseIf userInputValue <= 0 Then
123+
TAppOutput.FRAMES = 1
124+
Else
125+
TAppOutput.FRAMES = userInputValue
126+
EndIf
127+
SetGadgetText(TAppGUI.editSettingsFramesTextbox,TAppOutput.FRAMES)
128+
TAppOutput.FOutputUpdate()
129+
'Bacground Color
130+
'Red
131+
Case TAppGUI.editSettingsColorRTextbox
132+
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsColorRTextbox).ToInt()
133+
'Foolproofing
134+
If userInputValue > 255 Then
135+
TAppOutput.BACKGROUND_RED = 255
136+
ElseIf userInputValue < 0 Then
137+
TAppOutput.BACKGROUND_RED = 0
138+
Else
139+
TAppOutput.BACKGROUND_RED = userInputValue
140+
EndIf
141+
SetGadgetText(TAppGUI.editSettingsColorRTextbox,TAppOutput.BACKGROUND_RED)
142+
TAppOutput.FOutputUpdate()
143+
'Green
144+
Case TAppGUI.editSettingsColorGTextbox
145+
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsColorGTextbox).ToInt()
146+
'Foolproofing
147+
If userInputValue > 255 Then
148+
TAppOutput.BACKGROUND_GREEN = 255
149+
ElseIf userInputValue < 0 Then
150+
TAppOutput.BACKGROUND_GREEN = 0
151+
Else
152+
TAppOutput.BACKGROUND_GREEN = userInputValue
153+
EndIf
154+
SetGadgetText(TAppGUI.editSettingsColorGTextbox,TAppOutput.BACKGROUND_GREEN)
155+
TAppOutput.FOutputUpdate()
156+
'Blue
157+
Case TAppGUI.editSettingsColorBTextbox
158+
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsColorBTextbox).ToInt()
159+
'Foolproofing
160+
If userInputValue > 255 Then
161+
TAppOutput.BACKGROUND_BLUE = 255
162+
ElseIf userInputValue < 0 Then
163+
TAppOutput.BACKGROUND_BLUE = 0
164+
Else
165+
TAppOutput.BACKGROUND_BLUE = userInputValue
166+
EndIf
167+
SetGadgetText(TAppGUI.editSettingsColorBTextbox,TAppOutput.BACKGROUND_BLUE)
168+
TAppOutput.FOutputUpdate()
169+
EndSelect
170+
'Quitting confirm
171+
Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
172+
quitResult = Confirm("Quit program?")
173+
EndSelect
174+
'Quitting
175+
If quitResult Then Exit
176+
EndIf
177+
EndWhile
File renamed without changes.

0 commit comments

Comments
 (0)