Help: Function to load pngs from a list...

BlitzMax Forums/BlitzMax Beginners Area/Help: Function to load pngs from a list...

WarpZone(Posted 2005) [#1]
Okay, here's what I want to do: I don't want to have to write out:



for each PNG file that my game will use. I would much rather create a list of known PNG files in one place in my code (or maybe even read a list of all the PNG files in a directory) and then cycle through the list to load each item on it.

I tried to do it this way:



Compile Error: Expecting string literal but encountered identifier

I guess this means I can't plug a variable into Timage=LoadImage. If that's true, I can't really think of ANY way to load graphics dynamically. Which would suck, because it means it's impossible to ever make a moddable game that uses user-defined content.

Any suggestions? :/ Or is there a seperate command/technique for loading graphics from a directory?


tonyg(Posted 2005) [#2]
It's a compile time restriction...
Incbin string


QuietBloke(Posted 2005) [#3]
ermm.. I thought incbin was a way of telling the compiler to include the external file into the final executable.
If you want a moddable game that users can change the content then you just leave the incbin out of your code and it will load the images from the file at runtime.
( I think )

John ( QuietBloke)


WarpZone(Posted 2005) [#4]
Oh. Yes, that makes sense. :/

I removed Incbin t, and the file works properly now.

I sort of wanted to do the valve thing of compiling all the art assets into the program executable, and then only replacing them if a duplicate file with the same name is visible in the directory, but come to think of it, that actually accomplishes very little and just makes the sexecutable file size huge for no reason.

So basically, you can either make a simple standalone game compressed into one impregnable exe file, or you can leave your art assets wide open and ripe for the modding.

I can live with having to choose one of those two options. :)


tonyg(Posted 2005) [#5]
You could also have a look at mpacker...
mpacker