Introduction to HaxeUI
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.
Embedding fonts in OpenFL
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):
Particle system in OpenFL using 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.
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.
The modes are: FULL_SCREEN, FULL_SCREEN_INTERACTIVE and NORMAL.
These values can be used both to check the current display mode and to set it.
Depth sorting in 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.