Skip to content

Commit 7d48ac9

Browse files
committed
Embed assets into executable
1 parent e963bbd commit 7d48ac9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

cccp-bender-main.bmx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Rem
2020
------- INDEXING ------------------------------------------------------------------------------------------------------
2121
EndRem
2222

23+
'Embed palette file for standalone exe
24+
Incbin "assets/palette.act"
25+
2326
Type TBitmapIndex
2427
'Color Value Bytes
2528
Global palR:Byte[256]
@@ -30,10 +33,10 @@ Type TBitmapIndex
3033
Global dataStream:TStream
3134

3235
'Load color table file
33-
Function FLoadPalette(paletteFile:String)
36+
Function FLoadPalette()
3437
Local index:Int
35-
If FileSize(paletteFile) = 768
36-
Local paletteStream:TStream = ReadFile(paletteFile)
38+
If IncbinLen("assets/palette.act") = 768
39+
Local paletteStream:TStream = ReadFile("Incbin::assets/palette.act")
3740
For index = 0 To 255
3841
palR[index] = ReadByte(paletteStream)
3942
palG[index] = ReadByte(paletteStream)
@@ -230,6 +233,9 @@ Rem
230233
------- OUTPUT ELEMENTS -----------------------------------------------------------------------------------------------
231234
EndRem
232235

236+
'Embed logo image for standalone exe
237+
Incbin "assets/logo-image"
238+
233239
Type TAppOutput
234240
'Output Window
235241
Global outputWindow:TGraphics
@@ -241,7 +247,7 @@ Type TAppOutput
241247
Const UPPER_BONE:Int = 0
242248
Const LOWER_BONE:Int = 1
243249
'Graphic Assets
244-
Global logoImage:TImage = LoadImage("assets/logo-image",MASKEDIMAGE)
250+
Global logoImage:TImage = LoadImage("Incbin::assets/logo-image",MASKEDIMAGE) '
245251
Global sourceImage:TImage
246252
Global boneImage:TImage[BONES]
247253
'Output Settings
@@ -555,7 +561,7 @@ Type TAppGUI
555561
If Not mainToEdit And importedFile <> Null Then
556562
FAppEditor()
557563
TAppOutput.FOutputBoot()
558-
TBitmapIndex.FLoadPalette("assets/palette.act")
564+
TBitmapIndex.FLoadPalette()
559565
mainToEdit = True
560566
EndIf
561567
EndFunction

0 commit comments

Comments
 (0)