Giter VIP home page Giter VIP logo

haxeui-kha's Introduction

Build Status Support this project on Patreon

haxeui-kha

haxeui-kha is the Kha backend for HaxeUI.

Installation

  • haxeui-kha has a dependency to haxeui-core, and so that too must be installed.
  • haxeui-kha also has a dependency to Kha, 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-kha path/to/expanded/source/archive

Usage

The simplest method to create a new Kha 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:

khamake.js

Simply add the following lines to your khamake.js and rebuild your project files (using haxelib run kha html5 for example):

project.addLibrary('haxeui-core');
project.addLibrary('haxeui-kha');
project.addLibrary('hscript');

Toolkit initialisation and usage

The Kha system itself must be initialised and a render loop started. This can be done by using code similar to:

public function new() {
    Assets.loadEverything(onAssetsLoaded);
}

function onAssetsLoaded() {
    Toolkit.init();
    System.notifyOnRender(render);
}

function render(framebuffer:Framebuffer): Void {		
    var g = framebuffer.g2;
    g.begin(true, 0xFFFFFF);
    Screen.instance.renderTo(g);
    g.end();
}

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

Kha specifics

As well as using the generic Screen.instance.addComponent, it is also possible to render a component to a specific surface use the components special renderTo function. Eg:

main.renderTo(...);

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.

haxeui-kha's People

Contributors

andyli avatar aw4kening avatar elnabo avatar ianharrigan avatar ibilon avatar sh-dave avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.