How incbin function is working?
BlitzMax Forums/BlitzMax Beginners Area/How incbin function is working?
| ||
Hello, I would like to ask how incbin function is working? I would like to put one directory which contains the gui skin of the game in the compiled .exe file. Any idea? Thank you :) |
| ||
Something like this should help you get started...' Incbin resource file for Infection release builds to include resources. ' Last edit: 4/2/2015 ' ** Graphics ** Incbin "gfx/bug.png" Incbin "gfx/spark.png" Incbin "gfx/title.png" Incbin "gfx/syringe.png" Incbin "gfx/particle.png" BugImage = LoadImage("Incbin::gfx/bug.png") SparkImage = LoadImage("Incbin::gfx/spark.png") LogoImage = LoadImage("Incbin::gfx/title.png") PlayerImage = LoadImage("Incbin::gfx/syringe.png") ParticleImage = LoadImage ("Incbin::gfx/particle.png") ' ** Music ** Incbin "music/original title.ogg" Music = LoadSound("Incbin::music/original title.ogg", True) ' ** Fonts ** Incbin "fonts/BAUHS93.ttf" MainFont:TImageFont = LoadImageFont("Incbin::fonts/BAUHS93.ttf", 18) SmallFont:TImageFont = LoadImageFont("Incbin::fonts/BAUHS93.ttf", 12) Incbin "fonts/Autumn__.ttf" HighScoreFont:TImageFont = LoadImageFont("Incbin::fonts/Autumn__.ttf", 24) ' ** Sound ** Incbin "sfx/rain.ogg" Rain:TSound = LoadSound("Incbin::sfx/rain.ogg", True) Incbin "sfx/pop.wav" PopSound:TSound = LoadSound("Incbin::sfx/pop.wav", False) Incbin "sfx/LevelComplete.wav" LevelCompleteSound:TSound = LoadSound("Incbin::sfx/LevelComplete.wav", False) Incbin "sfx/GameOver.wav" GameOverSound:TSound = LoadSound("Incbin::sfx/GameOver.wav", False) Incbin "sfx/Maximum.wav" MaximumSound:TSound = LoadSound("Incbin::sfx/Maximum.wav", False) Incbin "sfx/Blip.wav" KeySound:TSound = LoadSound("Incbin::sfx/Blip.wav", False) Incbin "sfx/Error.wav" ErrorSound:TSound = LoadSound("Incbin::sfx/Error.wav", False) |
| ||
So if I need to include one folder which contains a lots of subfolders. Can I use just simple: Incbin "folder" Do I need to include all files in the folder separately one by one? The example above is nice but this example add in the include binary each file manually. |
| ||
Do I need to include all files in the folder separately one by one? Yes. |
| ||
I tried to include whole ifsogui skinIncBin "Gui_Skin/fonts/arial.ttf" IncBin "Gui_Skin/Graphics/arrow.png" IncBin "Gui_Skin/Graphics/button.png" IncBin "Gui_Skin/Graphics/buttonover.png" IncBin "Gui_Skin/Graphics/checkboxoff.png" IncBin "Gui_Skin/Graphics/checkboxon.png" IncBin "Gui_Skin/Graphics/combobox.png" IncBin "Gui_Skin/Graphics/combobutton.png" IncBin "Gui_Skin/Graphics/combodrop.png" IncBin "Gui_Skin/Graphics/dimensions.txt" IncBin "Gui_Skin/Graphics/imagebutton.png" IncBin "Gui_Skin/Graphics/label.png" IncBin "Gui_Skin/Graphics/listbox.png" IncBin "Gui_Skin/Graphics/mclistbox.png" IncBin "Gui_Skin/Graphics/mclistboxbutton.png" IncBin "Gui_Skin/Graphics/mltextbox.png" IncBin "Gui_Skin/Graphics/mltextbox___.png" IncBin "Gui_Skin/Graphics/panel.png" IncBin "Gui_Skin/Graphics/progressbar.png" IncBin "Gui_Skin/Graphics/progressbarstretch.png" IncBin "Gui_Skin/Graphics/progressbartile.png" IncBin "Gui_Skin/Graphics/scrollback.png" IncBin "Gui_Skin/Graphics/scrollbar.png" IncBin "Gui_Skin/Graphics/scrollbutton.png" IncBin "Gui_Skin/Graphics/slider.png" IncBin "Gui_Skin/Graphics/Slider_Handle.bmp" IncBin "Gui_Skin/Graphics/sliderback.png" IncBin "Gui_Skin/Graphics/slidertick.png" IncBin "Gui_Skin/Graphics/spinner.png" IncBin "Gui_Skin/Graphics/tabber.png" IncBin "Gui_Skin/Graphics/textbox.png" IncBin "Gui_Skin/Graphics/window.bmp" IncBin "Gui_Skin/Graphics/window.png" IncBin "Gui_Skin/Graphics/windowcaption.png" IncBin "Gui_Skin/Graphics/cursors/dimensions.txt" IncBin "Gui_Skin/Graphics/cursors/ibar.png" IncBin "Gui_Skin/Graphics/cursors/mousedown.png" IncBin "Gui_Skin/Graphics/cursors/mouseover.png" IncBin "Gui_Skin/Graphics/cursors/mouseresize.png" IncBin "Gui_Skin/Graphics/cursors/normal.png" GUI.LoadTheme("incbin::Gui_Skin") I tried to load the theme and the program crashes. The directory exist in the same folder when the exe file compiles. It supposed not needed after compile. |
| ||
You're trying to incbin the entire directory. After you include each resource seperately you will still need to load the assets in with a seperate line into their own image pointer. If that makes sense. |
| ||
Example by Marcus Trisdale of how to incbin a zip file with skins included. You will need Skins.zip. |
| ||
I liked your example very very much. I will use it for my game. The only problem is , when you use password in the zip shows EXCEPTION_ACCESS_VIOLATION error Thank you very much. |