Feature req.: flag to avoid incbinning during dev

BlitzMax Forums/BlitzMax Programming/Feature req.: flag to avoid incbinning during dev

RepeatUntil(Posted 2006) [#1]
I am using incbin for all the medias and text files. The text files allow me to modify the way the program works. I am working with someone (graphist) who doesn't have BlitzMax, and so he needs an executable AND the media and text files to be able to play with them.
As these files are all incbin'ed, he can not access it.
So here is my feature request: it would be VERY practical during the development phase to be able to turn off incbin, even when we use it in the program. That could be through a "incbin Off" in the main program, or an option in the IDE.
This option is really needed and would be a clear +. What BRL thinks??


Tricky(Posted 2006) [#2]
Perhaps you can try this:

Dev version
Global Dir$ = "./"
Rem
Incbin "Picture.png"
Dir = "incbin::"
end rem
Global Img:TImage = Loadimage(dir+"Picture.png")


Release
Global Dir$ = "./"
Incbin "Picture.png"
Dir = "incbin::"
Global Img:TImage = Loadimage(dir+"Picture.png")


Removing the "Rem" commands will hereby enable the incbins.
Placing them in will disable it.

Not really a beauty, but it will do.

Brings me to the questions.
Has the "#ifdef" request made before already been put in place?
That would also be a way to solve this prob.


Jim Teeuwen(Posted 2006) [#3]
in bmax 1.20.

?Debug
 Print("debug")
?
Print("foo");


the ? thingies are basicly pre-processor directives.
I have no idea which ones are defined by default except for:

?Win32
?Linux
?MacOS

and I just happened to be lucky when guessing: ?Debug.
Appearantly it works (in the default max IDE anyways).

the above code in DebugMode prints:
--------------
debug
foo
--------------

and in Release mode:
--------------
foo
--------------

Edit: Actually I lie. I installed the 'MaxIDE120F' by Skidracer a few days ago. So it may, or may not work in the standard Max IDE. It does in 'MaxIDE120F' at any rate.


Byteemoz(Posted 2006) [#4]
The Compiler Directives do not depend on the IDE...
-- Byteemoz


Hotcakes(Posted 2006) [#5]
Furthermore, constants are fully taken care of during compiling, so you could have yourself some code like...

Const release=0
If release
  Print "This code will never be compiled"
EndIf


Couple that with Tricky's solution and you'll only ever have to change one variables value.


Tricky(Posted 2006) [#6]
Too bad there's no "?Release" directive. That makes it impossible to incbin in the release only. But since it doesn't exist. :-(

Don't understand why, though....


slenkar(Posted 2006) [#7]
what about
if ?debug=false



Hotcakes(Posted 2006) [#8]
All ? statements are hardcoded directives. They don't work like commands do.


RepeatUntil(Posted 2006) [#9]
OK, thanks.
The solution of Toby does not work since the command incbin can not be in a if statement.
So I use the first solution given by Tricky...

But BRL could definitely do something here....


Dreamora(Posted 2006) [#10]
For update reasons, I wouldn't use incbin.
Better use the zlib commands and put all media in an encrypted zip file. That way you can update the app without a XX mb download although the app itself would only be 200kb ...


Hotcakes(Posted 2006) [#11]
The solution of Toby does not work since the command incbin can not be in a if statement.

You're kidding... well shoot. I think Ifs based on constants should be an exception...


Regular K(Posted 2006) [#12]


?


RepeatUntil(Posted 2006) [#13]
Regular K, yes, your solution is working, BUT in development process, I am often running without debug mode to be able to compile faster...

Dreamora: do you know about a lib which does encryption on a file?