Skip to content

Haxe General Notes

Haxe

// haxe --main Main --interp -> 'Hello world'
class Main {
static public function main():Void {
trace("Hello World");
}
}

Haxe Dox

Generating documentation is a three-step process:

Terminal window
haxelib install dox
/**
Foo Bar.
*/
Terminal window
-cp src
-D doc-gen
--macro include('pack')
--no-output
--each
--next
-xml bin/neko.xml
-neko dummy.n
--next
-xml bin/flash.xml
-swf dummy.swf
Terminal window
haxelib run dox -i docs

Haxe 3D

OpenFL - Lime

Template Customize

<template path="templates/index.html" rename="index.html" if="html5" />

HTML scripts

Use the <dependency/> tag to include external JS files like so: <dependency if="html5" path="dependencies/soundjs.min.js" /> or <dependency if="html5" path="dependencies/ammo.js" />

canvas = Browser.document.getElementsByTagName("canvas").item(0);
// setInterval() for js
timerID = Browser.window.setInterval(scheduler, lookahead);

Unreal Engine

Types

Type System

MetaData

Compiler

  • @:event [cs] - Automatically added by --net-lib on events. Has no effect on types compiled by Haxe.
  • @:noCompletion [all] - Prevents the compiler from suggesting completion on this field or type.
  • @:access(<Target path>) [all] - Forces private access to package, type or field.

Feathersui

Command Line Setup

Terminal window
haxelib install feathersui
haxelib run openfl setup
haxelib update feathersui

Create Project

Terminal window
haxelib run feathersui new-project HelloWorld

Run the project

Terminal window
openfl test html5 -debug

Build the project

Terminal window
openfl build html5

Feathers UI CLI command reference

Terminal window
haxelib run feathersui new-project <path> [options]
Terminal window
haxelib run feathersui new-project HelloWorld --vscode
code HelloWorld

new-project

  • —vscode - The new project will include supporting files for Visual Studio Code.
  • —openfl - The new project’s main class will extend openfl.display.Sprite instead of feathers.controls.Application
  • —verbose - Show additional detailed output.

help

Terminal window
haxelib run feathersui help <command>
# Example: Display a list of all available commands.
haxelib run feathersui help
# Example: Display a list of all available options for the new-project command.
haxelib run feathersui help new-project

Main.hx

import feathers.core.Application;
class MyProject extends Application {
public function new() {
super();
var label = new Label();
label.text = "Hello from Feathers UI and OpenFL";
this.addChild(label);
}
}

project.xml

<?xml version="1.0" encoding="utf-8"?>
<project>
<meta title="My Project" package="com.example.MyProject" version="1.0.0" company="My Company"/>
<app main="MyProject" path="build" file="MyProject"/>
<window allow-high-dpi="true"/>
<window fps="60"/>
<window fps="0" if="html5"/>
<source path="src"/>
<haxelib name="openfl"/>
<haxelib name="actuate"/>
<haxelib name="feathersui"/>
</project>

See also

build.hxml

Terminal window
-cp src
-main HelloWorld
-swf LibraryTest.swc
-dce std
Terminal window
$> haxe build.hxml

Lime

Lime is a flexible, lightweight layer for Haxe cross-platform developers. Lime provides a common foundation on native and dynamic targets for window and application life-cycle management, access to rendering and sound, plus many other useful features for cross-platform development.

Write in the expressive Haxe programming language, then compile to native C++, JavaScript and other technologies.

XML Format

Usually a simple project file is all you need to build projects using Lime, but it can be extended based on your needs. Here is a reference of what you can do.

HXP Format

The *.hxp format is based upon Haxe, it mirrors the internal project format used within Lime tools. There is a lot of flexibility and power that can come from using an *.hxp project, but be aware that as the Lime tools evolve, the specification may change slightly.

Resources

OpenGL

Haxe child pages

  • [[haxe:rtti:start|Haxe RTTI Start Page]]

Feathersui child pages