Skip to content

Commit ec499b5

Browse files
author
MaximDude
committed
Set up color table loader
1 parent 5bed704 commit ec499b5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

cccp-bender-main.bmx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,34 @@ Import BRL.PNGLoader
1414
Global appVersion:String = "1.1"
1515
Global appVersionDate:String = "20 Sep 2019"
1616

17+
Rem
18+
------- INDEXING ------------------------------------------------------------------------------------------------------
19+
EndRem
20+
21+
Type TBitmapIndex
22+
Const GFX_PAL:Byte=0
23+
24+
'Color Value Bytes
25+
Global palR:Byte[256]
26+
Global palG:Byte[256]
27+
Global palB:Byte[256]
28+
29+
'Load color table file
30+
Function FLoadPalette(paletteFile:String)
31+
Local index:Int
32+
If FileSize(paletteFile) = 768
33+
Local paletteStream:TStream = ReadFile(paletteFile)
34+
For index = 0 To 255
35+
palR[index] = ReadByte(paletteStream)
36+
palG[index] = ReadByte(paletteStream)
37+
palB[index] = ReadByte(paletteStream)
38+
Next
39+
CloseStream paletteStream
40+
EndIf
41+
EndFunction
42+
43+
EndType
44+
1745
Rem
1846
------- FILE IO -------------------------------------------------------------------------------------------------------
1947
EndRem
@@ -398,6 +426,7 @@ Type TAppGUI
398426
If Not mainToEdit And importedFile <> Null Then
399427
FAppEditor()
400428
TAppOutput.FOutputBoot()
429+
TBitmapIndex.FLoadPalette("assets/palette.act")
401430
mainToEdit = True
402431
EndIf
403432
EndFunction
@@ -410,6 +439,7 @@ EndRem
410439
New TAppGUI
411440
New TAppOutput
412441
New TAppFileIO
442+
New TBitmapIndex
413443
TAppGUI.FAppMain()
414444

415445
Rem

0 commit comments

Comments
 (0)