Incbin issue
BlitzMax Forums/BlitzMax Beginners Area/Incbin issue
| ||
Incbin "graphics\redleft.png" Global redleft:TImage = LoadImage("incbin::redleft.png") That results in redleft being null. I've never fiddled with incbin before but what I've seen indicates that that should work, no? |
| ||
No. Try LoadImage("incbin::graphics\redleft.png") |
| ||
Oh. I might add that if I change "incbin::redleft.png" to "graphics\redleft.png" it works fine so I know the image is getting loaded. |
| ||
ah. Thanks. I didn't realize it would keep the directory structure as well. |
| ||
That's by design: if you include the folder path in the incbin statement, you have to retrieve it using the same (virtual) folder path as well. |
| ||
Yep - its especially handy as it lets you do this:Global datapath:String = "incbin::" Include "incbin.bmx" ' list of incbinned files in here 'datapath = "" LoadImage(datapath + "graphics\redleft.png") Why is this handy? Well, if you've got a lengthy program with hundreds of incbinned files, it will take ages to compile. When debugging its streamlines things a bit more if you comment out the second line, and uncomment the third line - forcing it to bypass incbin completely and load files from their respective folders. |
| ||
Very clever! makes perfect sense. |
| ||
Did you ever try the combination with Koriolis.ZipStream.Mod? I use it since years and it is very comfortable. with Koriolis.ZipStream.Mod you have to incbin only one file: a ZIP-File, where all your files are packed. An this is the code: If you add your files to a ZIP without path structure: SuperStrict Import koriolis.zipstream Incbin "MyFiles.ZIP" ' DataPath = "graphics\" DataPath="ZIP::Incbin::MyFiles.ZIP//" and swap to direct loading, as GfK told you: SuperStrict Import koriolis.zipstream ' Incbin "MyFiles.ZIP" DataPath = "graphics\" ' DataPath="ZIP::Incbin::MyFiles.ZIP//" but you also could add the files to the ZIP including the path structure. Then use this code: SuperStrict Import koriolis.zipstream Incbin "MyFiles.ZIP" ' DataPath = "graphics\" DataPath="ZIP::Incbin::MyFiles.ZIP//graphics\" |
| ||
Interesting. I might look into that. Thanks. |
| ||
As a side-note: koriolis' mod also supports password protected zip files, so you can add an additional layer of protection if you are concerned about your media files. |