IncludeBinary Tip
Posted: Mon Aug 30, 2010 8:55 pm
While working on a game I was including a lot of images. I figured why should I have to write them all out. See code below. Change "ImageNum" if you are adding to the DataSection.
Code: Select all
Dir$ = "Game Images\"
ImageNum = 0
ExamineDirectory(0, Dir$, "*.png")
Repeat
Result = NextDirectoryEntry(0)
ImageName$ = DirectoryEntryName(0)
ImageNum +1
If Result = 0
Break
EndIf
;Debug "Pic" + Str(ImageNum) + ": IncludeBinary " + Chr(34) + Dir$ + ImageName$ + Chr(34)
Debug "CatchSprite(" + Str(ImageNum) + ", " + "?Pic" + Str(ImageNum) + ", " + "#PB_Sprite_AlphaBlending | #PB_Sprite_Texture)" + " ;" + ImageName$
ForEver
FinishDirectory(0)