Flixel Frontends

Edit

Frontends in HaxeFlixel 3.x are a new structure to the core of Flixel and which tackles the often criticized bloated collection of static methods in FlxG.

Frontends are accessed in FlxG.frontend in a similar fashion to what Flixel devs are used to. Careful thought has been given to organise them into logical shortcuts. This way the API will be easier to browse, remember and maintain.

For example in HaxeFlixel 2.x to add a FlxCamera you would use FlxG.addCamera(camera:FlxCamera);, this addCamera() method has been moved into a cameras frontend with all the other FlxCamera-related methods. So the code in HaxeFlixel 3.x to add a FlxCamera is now FlxG.cameras.add(camera:FlxCamera).

The Flixel FrontEnds are as follows:

FlxG.inputs

A reference to the InputFrontEnd object. Mostly used internally, but you can use it too to reset inputs and create input classes of your own.

FlxG.console

A reference to the ConsoleFrontEnd object. Use it to register functions and objects or add new commands to the console window.

FlxG.log

A reference to the LogFrontEnd object. Use it to add messages to the log window. It is recommended to use trace() instead of the old FlxG.log(), since traces will be redirected by default.

FlxG.watch

A reference to the WatchFrontEnd object. Use it to add or remove things to / from the watch window.

FlxG.debugger

A reference to the DebuggerFrontEnd object. Use it to show / hide / toggle the debugger change its layout, activate visual debugging or change the key used to toggle it.

FlxG.vcr

A reference to the VCRFrontEnd object. Contains all the functions needed for recording and replaying.

FlxG.bitmap

A reference to the BitmapFrontEnd object. Contains things related to bitmaps, for example regarding the bitmap cache and the cache itself.

FlxG.cameras

A reference to the CameraFrontEnd object. Contains things related to cameras, a list of all cameras and camera effects like flash() or shake().

FlxG.plugins

A reference to the PluginFrontEnd object. Contains a list of all plugins and the functions required to add(), remove() them etc.

FlxG.sound

A reference to the SoundFrontEnd object. Contains a list of all sounds and other things to manage or play() sounds.

FlxG.html5

Provides information on some HTML5-specific things like browser, browserPosition etc...