Virtually adds this property to a class:
public function myVar(get, null):Float;
private inline function get_myVar():Float {
return 1.5;
}
| /** | |
| * Custom flambe embed for JavaScript-target only. | |
| * Author: Mark Knol - http://blog.stroep.nl | |
| */ | |
| var flambe = {}; | |
| /** | |
| * Embed a Flambe game into the page. | |
| * | |
| * @return True if the game was successfully embedded. |
| package; | |
| import haxe.web.Dispatch; | |
| import haxe.web.Request; | |
| import php.Lib; | |
| /** | |
| Dispatch Example | |
| * Make sure `mod_rewrite` is enabled | |
| * You can add any `doBla` in Routes and it becomes an url /bla | |
| package temple.components; | |
| import flambe.Component; | |
| /** | |
| Dispose its owner entity after a given delay. | |
| Example: | |
| `myEntity.add(new AutoDisposer(5);` | |
| Example with callback: |
The official Haxe sources:
Getting better all the time, this is the definitive guide though quite meaty and requires a good couple of passes before things make sense. Learn from simple examples and practicing, use the manual as a reference.
Macronauts: Macro workshop
instruction: look for condition in code like
if (xx == yy)
replace with
if (xx = yy)
color to hex http://try.haxe.org/#F5127
zip test http://try.haxe.org/#6ad3E
loops without loops http://try.haxe.org/#02FF0
StringTools.eregReplace http://try.haxe.org/#C6d8F
Random haxelib generator https://try.haxe.org/#C985a
| class Main { | |
| static function main() { | |
| addConsoleLogViewer(); | |
| } | |
| public static inline function addConsoleLogViewer(align = "bottom", minimized = true, totalItems = 45) { | |
| #if consolelogviewer | |
| var script = js.Browser.document.createScriptElement(); | |
| script.type = "text/javascript"; | |
| script.src = 'https://markknol.github.io/console-log-viewer/console-log-viewer.js?align=$align&minimized=$minimized'; |
| package temple.utils; | |
| import flambe.System; | |
| /** | |
| * @author Mark Knol [http://blog.stroep.nl] | |
| */ | |
| class ExternalUtil | |
| { | |
| #if air | |
| public static var airBrowser:AirBrowser = new AirBrowser(); |
| var _connection:SignalConnection; | |
| override public function onStart() | |
| { | |
| // grap HeartBeat component somewhere in parent entities | |
| var heartBeat = owner.getFromParents(HeartBeat); | |
| // listen to it | |
| _connection = heartBeat.beat.changed.connect(onBeatChanged); | |