Skip to content

Commit 5bd1ae8

Browse files
author
MaximDude
committed
Fixed issue with windres on compile, GUI now uses WinAero features
Some GUI position adjustments Changes to dependencies
1 parent 0c4fe91 commit 5bd1ae8

File tree

1 file changed

+48
-44
lines changed

1 file changed

+48
-44
lines changed

cccp-bender-main.bmx

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ Rem
55
TBA
66
EndRem
77

8-
Strict
8+
SuperStrict
99

1010
'Import dependencies into build
1111
Import MaxGUI.Drivers
12-
Import BRL.FileSystem
12+
Import BRL.Max2D
13+
Import BRL.Pixmap
14+
Import BRL.PNGLoader
1315

1416
'Version
1517
Global appVersion:String = "0.1"
@@ -27,6 +29,8 @@ Global quitResult:Int = False
2729

2830
'App Output Elements
2931
Type TAppOutput
32+
'Output Window
33+
Global outputWindow:TGraphics
3034
'Draw Bools
3135
Global doDraw:Int = False
3236
Global redoBoneImage:Int = False
@@ -65,8 +69,8 @@ Type TAppOutput
6569
boneImage[b] = CreateImage(TILESIZE,TILESIZE,1,MASKEDIMAGE)
6670
GrabImage(boneImage[b],b*TILESIZE,0)
6771
Next
68-
'Set up default bone sizes.
69-
For i = 0 To BONES-1
72+
'Set up default bone sizes
73+
For i = 0 To BONES-1
7074
jointX[i] = TILESIZE/2
7175
jointY[i] = TILESIZE/3.6
7276
boneLength[i] = ((TILESIZE/2-jointY[i])*2)
@@ -77,17 +81,15 @@ Type TAppOutput
7781
'Create output window and draw assets
7882
Function FOutputBoot()
7983
'SetGraphicsDriver GLGraphicsDriver()
80-
Graphics(640,480,0,0,0)
84+
outputWindow = Graphics(640,480,0,0,0)
8185
'Window background color
8286
SetClsColor(BACKGROUND_RED,BACKGROUND_GREEN,BACKGROUND_BLUE)
8387
SetMaskColor(255,0,255)
8488
'DrawImage(sourceImage,0,0)
8589
DrawImageRect(sourceImage,0,0,ImageWidth(sourceImage)*ZOOM,ImageHeight(sourceImage)*ZOOM)
8690
FCreateLimbTiles()
8791
FLimbBend()
88-
Flip(1)
89-
'FOutputDraw()
90-
'Cls
92+
'Flip(1)
9193
doDraw = True
9294
EndFunction
9395

@@ -131,9 +133,9 @@ Type TAppOutput
131133
If ym < (TILESIZE/2-2) And ym > 0 And xm > 0 And xm < TILESIZE*BONES Then
132134
Local b:Int = xm/TILESIZE
133135
jointX[b] = TILESIZE/2 'X is always at center, so kinda pointless to even bother - at the moment
134-
jointY[b] = ym 'Determines length
136+
jointY[b] = ym 'Determines length
135137
boneLength[b] = (TILESIZE/2 -ym)*2
136-
SetImageHandle(boneImage[b],jointX[b],jointY[b]) 'Rotation handle.
138+
SetImageHandle(boneImage[b],jointX[b],jointY[b]) 'Rotation handle.
137139
EndIf
138140
EndFunction
139141

@@ -181,14 +183,14 @@ Type TAppOutput
181183
Local f:Int, b:Int
182184
For f = 0 To FRAMES-1
183185
'These might be in a specific draw-order for joint overlapping purposes
184-
b = 0 SetRotation(angle[b,f]) DrawImageRect(boneImage[b],xBone[b,f],yBone[b,f],ImageWidth(boneImage[b])/ZOOM,ImageHeight(boneImage[b])/ZOOM)
185-
b = 1 SetRotation(angle[b,f]) DrawImageRect(boneImage[b],xBone[b,f],yBone[b,f],ImageWidth(boneImage[b])/ZOOM,ImageHeight(boneImage[b])/ZOOM)
186-
b = 2 SetRotation(angle[b,f]) DrawImageRect(boneImage[b],xBone[b,f],yBone[b,f],ImageWidth(boneImage[b])/ZOOM,ImageHeight(boneImage[b])/ZOOM)
187-
b = 3 SetRotation(angle[b,f]) DrawImageRect(boneImage[b],xBone[b,f],yBone[b,f],ImageWidth(boneImage[b])/ZOOM,ImageHeight(boneImage[b])/ZOOM)
188-
b = 4 SetRotation(angle[b,f]) DrawImageRect(boneImage[b],xBone[b,f],yBone[b,f],ImageWidth(boneImage[b])/ZOOM,ImageHeight(boneImage[b])/ZOOM)
189-
b = 5 SetRotation(angle[b,f]) DrawImageRect(boneImage[b],xBone[b,f],yBone[b,f],ImageWidth(boneImage[b])/ZOOM,ImageHeight(boneImage[b])/ZOOM)
190-
b = 6 SetRotation(angle[b,f]) DrawImageRect(boneImage[b],xBone[b,f],yBone[b,f],ImageWidth(boneImage[b])/ZOOM,ImageHeight(boneImage[b])/ZOOM)
191-
b = 7 SetRotation(angle[b,f]) DrawImageRect(boneImage[b],xBone[b,f],yBone[b,f],ImageWidth(boneImage[b])/ZOOM,ImageHeight(boneImage[b])/ZOOM) 'DrawImage(boneImage[b],xBone[b,f],yBone[b,f])
186+
b = 0 SetRotation(angle[b,f]) DrawImage(boneImage[b],xBone[b,f],yBone[b,f]) 'DrawImageRect(boneImage[b],xBone[b,f],yBone[b,f],ImageWidth(boneImage[b])/ZOOM,ImageHeight(boneImage[b])/ZOOM)
187+
b = 1 SetRotation(angle[b,f]) DrawImage(boneImage[b],xBone[b,f],yBone[b,f])
188+
b = 2 SetRotation(angle[b,f]) DrawImage(boneImage[b],xBone[b,f],yBone[b,f])
189+
b = 3 SetRotation(angle[b,f]) DrawImage(boneImage[b],xBone[b,f],yBone[b,f])
190+
b = 4 SetRotation(angle[b,f]) DrawImage(boneImage[b],xBone[b,f],yBone[b,f])
191+
b = 5 SetRotation(angle[b,f]) DrawImage(boneImage[b],xBone[b,f],yBone[b,f])
192+
b = 6 SetRotation(angle[b,f]) DrawImage(boneImage[b],xBone[b,f],yBone[b,f])
193+
b = 7 SetRotation(angle[b,f]) DrawImage(boneImage[b],xBone[b,f],yBone[b,f])
192194
Next
193195
SetRotation(0)
194196
Flip(1)
@@ -205,16 +207,15 @@ Type TAppGUI
205207
Global mainToEdit:Int = False
206208
'Main Window
207209
Global mainWindow:TGadget
208-
'Main Window Label
209-
'Global mainWindowLabel:TGadget
210+
'Footer Label
211+
Global mainWindowFooterLabel:TGadget
210212
'Main Window Buttons
211213
Global mainWindowButtonPanel:TGadget
212214
Global mainLoadButton:TGadget
213215
Global mainQuitButton:TGadget
214216
'Main Window About
215217
Global mainAboutPanel:TGadget
216218
Global mainAboutTextbox:TGadget
217-
218219
'Editor Window
219220
Global editWindow:TGadget
220221
'Editor Window Buttons
@@ -228,7 +229,7 @@ Type TAppGUI
228229
Global editSettingsFramesTextbox:TGadget
229230
Global editSettingsColorRTextbox:TGadget
230231
Global editSettingsColorGTextbox:TGadget
231-
Global editSettingsColorBTextbox:TGadget
232+
Global editSettingsColorBTextbox:TGadget
232233
Global editSettingsZoomLabel:TGadget
233234
Global editSettingsFramesLabel:TGadget
234235
Global editSettingsColorLabel:TGadget
@@ -241,23 +242,23 @@ Type TAppGUI
241242

242243
'Create Main App Window
243244
Function FAppMain()
244-
mainWindow = CreateWindow("CCCP Bender v"+appVersion,DesktopWidth()/2-150,DesktopHeight()/2-180,300,360,Null,WINDOW_TITLEBAR)
245-
'mainWindowLabel = CreateLabel("",0,0,GadgetWidth(mainWindow),100,TAppGUI.mainWindow,LABEL_LEFT)
246-
mainWindowButtonPanel = CreatePanel(GadgetWidth(mainWindow)/2-80,10,150,97,mainWindow,PANEL_GROUP)
247-
mainLoadButton = CreateButton("Load Sprite",GadgetWidth(mainWindowButtonPanel)/2-70,0,130,30,mainWindowButtonPanel,BUTTON_PUSH)
248-
mainQuitButton = CreateButton("Quit",GadgetWidth(mainWindowButtonPanel)/2-70,40,130,30,mainWindowButtonPanel,BUTTON_PUSH)
249-
mainAboutPanel = CreatePanel(GadgetWidth(mainWindow)/2-143,125,280,200,mainWindow,PANEL_GROUP," About : ")
250-
mainAboutTextbox = CreateTextArea(5,5,GadgetWidth(mainAboutPanel)-20,GadgetHeight(mainAboutPanel)-30,mainAboutPanel,TEXTAREA_WORDWRAP|TEXTAREA_READONLY)
251-
SetGadgetText(mainAboutTextbox,"Welcome to the CCCP Bender utility!~n~nIt's purpose is to make the life of modders easier by automagically generating bent limb frames.~n~nThe CC Bender was originally created by Arne Jansson (AndroidArts), the man behind all the Cortex Command artwork.~nThe CCCommunityProject Bender, however, is a brand new tool that allows more control and convenience For the modder (hopefully).~n~nThis tool utilizes Arne's original limb bend code, but also allows loading and saving sprites, along with other settings.~n~nCreated by MaximDude using BlitzMax MaxIDE 1.52~nCCCP Bender version 0.1 - 17 Aug 2019")
252-
EndFunction
245+
mainWindow = CreateWindow("CCCP Bender v"+appVersion,DesktopWidth()/2-150,DesktopHeight()/2-180,300,340,Null,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS)
246+
mainWindowButtonPanel = CreatePanel(GadgetWidth(mainWindow)/2-80,5,150,97,mainWindow,PANEL_GROUP)
247+
mainLoadButton = CreateButton("Load Sprite",GadgetWidth(mainWindowButtonPanel)/2-69,0,130,30,mainWindowButtonPanel,BUTTON_PUSH)
248+
mainQuitButton = CreateButton("Quit",GadgetWidth(mainWindowButtonPanel)/2-69,40,130,30,mainWindowButtonPanel,BUTTON_PUSH)
249+
mainAboutPanel = CreatePanel(GadgetWidth(mainWindow)/2-140,GadgetHeight(mainWindowButtonPanel)+15,280,200,mainWindow,PANEL_GROUP," About : ")
250+
mainAboutTextbox = CreateTextArea(7,3,GadgetWidth(mainAboutPanel)-21,GadgetHeight(mainAboutPanel)-30,mainAboutPanel,TEXTAREA_WORDWRAP|TEXTAREA_READONLY)
251+
SetGadgetText(mainAboutTextbox,"Welcome to the CCCP Bender utility!~n~nIt's purpose is to make the life of modders easier by automagically generating bent limb frames.~n~nThe CC Bender was originally created by Arne Jansson (AndroidArts), the man behind all the Cortex Command artwork.~nThe CCCommunityProject Bender, however, is a brand new tool that allows more control and convenience For the modder (hopefully).~n~nThis tool utilizes Arne's original limb bend code, but also allows loading and saving sprites, along with other settings.~n~nCreated by MaximDude using BlitzMax MaxIDE 1.52~nCCCP Bender version 0.1 - 17 Aug 2019")
252+
mainWindowFooterLabel = CreateLabel("CCCP Bender v"+appVersion+" by MaximDude",10,GadgetHeight(mainWindow)-20,GadgetWidth(mainWindow),15,mainWindow,LABEL_LEFT)
253+
EndFunction
253254

254255
'Create Editor Window
255256
Function FAppEditor()
256-
editWindow = CreateWindow("CCCP Bender v"+appversion+" - Editor",DesktopWidth()/2-640,DesktopHeight()/2-240,305,455,Null,WINDOW_TITLEBAR)
257+
editWindow = CreateWindow("CCCP Bender v"+appversion+" - Editor",DesktopWidth()/2-640,DesktopHeight()/2-240,300,430,Null,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS)
257258
editWindowButtonPanel = CreatePanel(10,7,280,57,editWindow,PANEL_GROUP)
258-
editLoadButton = CreateButton("Load",5,0,80,30,editWindowButtonPanel,BUTTON_PUSH)
259-
editSaveButton = CreateButton("Save",95,0,80,30,editWindowButtonPanel,BUTTON_PUSH)
260-
editQuitButton = CreateButton("Quit",185,0,80,30,editWindowButtonPanel,BUTTON_PUSH)
259+
editLoadButton = CreateButton("Load",6,0,80,30,editWindowButtonPanel,BUTTON_PUSH)
260+
editSaveButton = CreateButton("Save",96,0,80,30,editWindowButtonPanel,BUTTON_PUSH)
261+
editQuitButton = CreateButton("Quit",186,0,80,30,editWindowButtonPanel,BUTTON_PUSH)
261262
editSettingsPalel = CreatePanel(10,73,280,87,editWindow,PANEL_GROUP," Settings : ")
262263
editSettingsZoomTextbox = CreateTextField(80,12,30,20,editSettingsPalel)
263264
editSettingsFramesTextbox = CreateTextField(190,12,30,20,editSettingsPalel)
@@ -270,8 +271,8 @@ Type TAppGUI
270271
editSettingsColorRLabel = CreateLabel("R:",65,45,50,20,editSettingsPalel,LABEL_LEFT)
271272
editSettingsColorGLabel = CreateLabel("G:",120,45,50,20,editSettingsPalel,LABEL_LEFT)
272273
editSettingsColorBLabel = CreateLabel("B:",175,45,50,20,editSettingsPalel,LABEL_LEFT)
273-
editHelpPanel = CreatePanel(10,170,280,247,editWindow,PANEL_GROUP," Instructions : ")
274-
editHelpTextbox = CreateTextArea(5,5,GadgetWidth(editHelpPanel)-20,GadgetHeight(editHelpPanel)-30,editHelpPanel,TEXTAREA_WORDWRAP|TEXTAREA_READONLY)
274+
editHelpPanel = CreatePanel(10,170,280,250,editWindow,PANEL_GROUP," Instructions : ")
275+
editHelpTextbox = CreateTextArea(7,5,GadgetWidth(editHelpPanel)-21,GadgetHeight(editHelpPanel)-32,editHelpPanel,TEXTAREA_WORDWRAP|TEXTAREA_READONLY)
275276
SetGadgetText(editSettingsZoomTextbox,TAppOutput.ZOOM)
276277
SetGadgetText(editSettingsFramesTextbox,TAppOutput.FRAMES)
277278
SetGadgetText(editSettingsColorRTextbox,TAppOutput.BACKGROUND_RED)
@@ -323,16 +324,19 @@ While True
323324
Case TAppGUI.mainLoadButton
324325
importedFile = RequestFile("Select graphic file to open",fileFilers)
325326
TAppOutput.sourceImage = LoadImage(importedFile,0)
326-
'Print (importedFile)
327327
EndSelect
328328
EndSelect
329329
'In Editor Window
330330
ElseIf TAppGUI.mainToEdit Then
331331
Select EventID()
332+
Case EVENT_APPRESUME
333+
ActivateWindow(TAppGUI.editWindow)
334+
TAppOutput.doDraw = True
335+
Case EVENT_GADGETSELECT
336+
'ActivateGadget(TAppOutput.outputWindow)
332337
'Quitting confirm
333338
Case EVENT_WINDOWCLOSE, EVENT_APPTERMINATE
334-
quitResult = Confirm("Quit program?")
335-
339+
quitResult = Confirm("Quit program?")
336340
Case EVENT_GADGETACTION
337341
Select EventSource()
338342
'Quitting confirm
@@ -355,8 +359,8 @@ While True
355359
'Foolproofing
356360
If exportedFile <> Null Then
357361
'Writing new file
358-
Local tempOutputImage:TPixmap = GrabPixmap(0,0,640,480)
359-
SavePixmapPNG(tempOutputImage,exportedFile)
362+
Local tempOutputImage:TPixmap = GrabPixmap(0,0,640,480)
363+
SavePixmapPNG(tempOutputImage,exportedFile)
360364
EndIf
361365
'Settings textbox inputs
362366
'Scale
@@ -374,7 +378,7 @@ While True
374378
TAppOutput.TILESIZE = 24 * TAppOutput.ZOOM
375379
TAppOutput.redoBoneImage = True
376380
TAppOutput.doDraw = True
377-
'Frames
381+
'Frames
378382
Case TAppGUI.editSettingsFramesTextbox
379383
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsFramesTextbox).ToInt()
380384
'Foolproofing
@@ -387,7 +391,7 @@ While True
387391
EndIf
388392
SetGadgetText(TAppGUI.editSettingsFramesTextbox,TAppOutput.FRAMES)
389393
TAppOutput.doDraw = True
390-
'Bacground Color
394+
'Bacground Color
391395
'Red
392396
Case TAppGUI.editSettingsColorRTextbox
393397
Local userInputValue:Int = GadgetText(TAppGUI.editSettingsColorRTextbox).ToInt()

0 commit comments

Comments
 (0)