-
Notifications
You must be signed in to change notification settings - Fork 6
Conditional compilation
Sometimes you need two builds to be slightly different. The quick and dirty way is to use the compiler preprocessor: The following example will compile foo()
in html, and fuu()
in Flash, and bar()
in other platforms.
#if html
foo();
#elseif flash
fuu();
#else
bar();
#end
Such flags are simply said, just booleans, which could be provided to the haxe compiler. When provided they are true, when not provided, the are false. In your .yaml file, you can add these flags like this haxe_flags: -D flambe_disable_webgl
. You can also add own tags this way.
Disclaimer: This list might not be complete.
-
flash
Activated when compiling using Flash target -
js
Activated when compiling using Javascript -
html
Activated when compiling Web build -
air
Activated when compiling Air build (iOS, Android) -
android
Activated when compiling Android -
ios
Activated when compiling iOS -
firefox
Activated when compiling Firefox build -
debug
Activated when compiling withflambe build --debug
-
flambe_transparent
for transparent canvas backgrounds, HTML only. -
flambe_disable_html_retina
to disable canvas DPI scaling. -
flambe_disable_webgl
Disables webGL when true, HTML only. -
flambe_disable_canvas
Disables 2d canvas when true, HTML only. -
flambe_disable_autoresize
Disables canvas auto fit to browser-size, HTML only. -
flambe_html_audio_fix
? -
flambe_disable_firefox_mp3
Disables MP3 for Firefox 27, more info here
flambe_keep_asserts
flambe_keep_logs
flambe_debug_text
flambe_debug_renderer
flambe_disable_reloading
If you are using FlashDevelop, in the top of the bar there is a 'debug/release' dropdown. This option affects the debug flag. So you can use this wisely to automatically hide debug information. In release build, the code inside this block does not even exist.
#if debug
debugOnlyThing();
#end
More debugging topics can be found here: Debugging.
In most cases you may not need this, but you can get a list of all haxe-language specific predefined flags. You can get this list by running this command: haxe --help-defines
Documentation guide for Flambe - Targeted to version 4.0+
Flambe | Installation | Demo projects | Showcase | API Reference | Forum
Flambe is MIT licensed and available for free. Feel free to contribute!
- Home / Installation
- Entity / Components
- Core
- Assets
- Publish your game
- Other
- Editors
- Plugins, tools, extensions
- Help
- More Flambe