Hasufel / haxeui-flambe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

haxeui-flambe

`haxeui-flambe` is the `Flambe` backend for HaxeUI.

Installation

* `haxeui-flambe` has a dependency to `haxeui-core`, and so that too must be installed. * `haxeui-flambe` also has a dependency to Flambe, please refer to the installation instructions on their site.

Eventually all these libs will become haxelibs, however, currently in their alpha form they do not even contain a haxelib.json file (for dependencies, etc) and therefore can only be used by downloading the source and using the haxelib dev command or by directly using the git versions using the haxelib git command (recommended). Eg:

haxelib git haxeui-core https://github.com/haxeui/haxeui-core
haxelib dev haxeui-flambe path/to/expanded/source/archive

Usage

The simplest method to create a new `Flambe` application that is HaxeUI ready is to use one of the haxeui-templates. These templates will allow you to start a new project rapidly with HaxeUI support baked in.

If however you already have an existing application, then incorporating HaxeUI into that application is straightforward:

flambe.yaml

In order to use haxeui with an existing `Flambe` application you must add these libraries to your `flambe.yaml` configuration file as part of the `haxe_flags` attribute. Eg:
# Additional flags to pass to the Haxe compiler.
# haxe_flags: -lib nape -D foobar
haxe_flags: -swf-header 800:600:60:FFFFFF -lib haxeui-core -lib haxeui-flambe

Note: Currently you must also include haxeui-core explicitly during the alpha, eventually haxelib.json files will exist to take care of this dependency automatically.

Toolkit initialisation and usage

The `Flambe` system itself must be initialised and an asset pack loaded before HaxeUI can be initialised and used. This is done with code similar to:
// Wind up all platform-specific stuff
System.init();

// Load up the compiled pack in the assets directory named "bootstrap"
var manifest = Manifest.fromAssets("bootstrap");
var loader = System.loadAssetPack(manifest);
loader.get(onAssetsLoaded);

Initialising the toolkit requires you to add this single line somewhere before you start to actually use HaxeUI in your application but after you have loaded the Flambe asset pack:

private static function onAssetsLoaded(pack:AssetPack) {
    Toolkit.init( {
       assetPack: pack // let the toolkit know which asset pack we are using
    });
}

Once the toolkit is initialised you can add components using the methods specified here.

Flambe specifics

As well as using the generic Screen.instance.addComponent, it is also possible to add components directly using a Flambe entity. Eg:

System.root.addChild(new Entity().add(main));

Initialisation options

The configuration options that may be passed to `Tookit.init()` are as follows:
Toolkit.init({
    assetPack: pack // the asset pack to work with
});

Addtional resources

* haxeui-api - The HaxeUI api docs. * haxeui-guides - Set of guides to working with HaxeUI and backends. * haxeui-demo - Demo application written using HaxeUI. * haxeui-templates - Set of templates for IDE's to allow quick project creation. * haxeui-bdd - A behaviour driven development engine written specifically for HaxeUI (uses haxe-bdd which is a gherkin/cucumber inspired project). * WWX2016 presentation - A presentation given at WWX2016 regarding HaxeUI.

About


Languages

Language:Haxe 99.8%Language:CSS 0.2%