Introduction to HaxeUI

posted on Nov 03, 2014 in Haxe, OpenFL, HaxeUI
HaxeUI introduction button

HaxeUI is an OpenFL-based UI library.

You can use it in any OpenFL project to quickly add complex interface components to your application or game. All components are completely skinnable.

In this tutorial I'll show you how to install the library and create a simple application with a button.

Accomplishing this is actually not as obvious as it sounds, because HaxeUI components are not added directly to the display list using addChild(), but employ a Toolkit system which lets you create a number of "root" containers (usually just one) for drawing and managing all the UI controls.

28088     0

Embedding fonts in OpenFL

posted on Nov 02, 2014 in Haxe, OpenFL, Syntax
OpenFL embed font

There's a high chance that you'll want to use a custom font in your app or game, and it's one of those things that might take a bit of time to get working, so I wrote this short tutorial to demonstrate how to properly embed fonts in OpenFL.

I'm going to be utilizing the Assets class to load the font itself and use it to render text in a TextField.

Firstly, put your OTF or TTF font in the assets/fonts/ directory.

Make sure the application.xml file has the path to the fonts directory by adding the following line (if it doesn't already exist):

24527     0

Particle system in OpenFL using Tilesheet

posted on Nov 01, 2014 in Haxe, OpenFL, Game design
Particle system OpenFL Tilesheet

In this part I'll show you how to make a simple particle system from scratch using nothing but OpenFL and the built-in Tilesheet class.

I'll explain how to create and manage simple particles and their properties, such as velocity and acceleration. The example will include a simple collision of the particles with the floor.

Some knowledge about the Tilesheet class is required, so check out my Tilesheet tutorial if you haven't already.

Start by creating an OpenFL project using the default template.

22591     0

Toggle fullscreen in OpenFL

posted on Oct 31, 2014 in Haxe, OpenFL, Game design, Syntax
Toggle fullscreen in OpenFL

Fullscreen mode is widely available in games and apps that want to display as much content as possible, such as video players.

In this tutorial I'll show you how to toggle fullscreen mode using OpenFL.

There are three fullscreen modes in OpenFL, similarly to Flash API. They are all described in the StageDisplayState class using static properties.


These values can be used both to check the current display mode and to set it.

22631     0

Depth sorting in OpenFL

posted on Oct 30, 2014 in Haxe, OpenFL, Game design
Depth sorting OpenFL

In this tutorial I will show you how depth sorting works in OpenFL and how to sort Sprites based on their Y value.

OpenFL employs a DispayList pattern which people coming from AS3 will be familiar with.

All Sprites added using the addChild() method to a container (which is also visible) are sorted by their indices, which are set automatically when you add new Sprites.

Each newly added Sprite is placed on top of everything else, with its index being the biggest. Indices in OpenFL can be swapped and set explicitly using various methods.

23565     0