FlxGame is the heart of all Flixel games, and contains a bunch of basic game loops and things. It is a long and sloppy file that you shouldn't have to worry about too much! It is basically only used to create your game object in the first place, after that FlxG and FlxState have all the useful stuff you actually need.

Constructor

@:value({ startFullscreen : false, skipSplash : false, drawFramerate : 60, updateFramerate : 60, gameHeight : 0, gameWidth : 0 })new(gameWidth:Int = 0, gameHeight:Int = 0, ?initialState:InitialState, updateFramerate:Int = 60, drawFramerate:Int = 60, skipSplash:Bool = false, startFullscreen:Bool = false)

Instantiate a new game object.

Parameters:

gameWidth

The width of your game in pixels. If 0, the Project.xml width is used. If the demensions don't match the Project.xml, scaleMode will determine the actual display size of the game.

gameHeight

The height of your game in pixels. If 0, the Project.xml height is used. If the demensions don't match the Project.xml, scaleMode will determine the actual display size of the game.

initialState

A constructor for the initial state, ex: PlayState.new or ()->new PlayState(). Note: Also allows Class<FlxState> for backwards compatibility.

updateFramerate

How frequently the game should update. Default is 60 fps.

drawFramerate

Sets the actual display / draw framerate for the game. Default is 60 fps.

skipSplash

Whether you want to skip the flixel splash screen with FLX_NO_DEBUG.

startFullscreen

Whether to start the game in fullscreen mode (desktop targets only).

See also:

Variables

read onlydebugger:FlxDebugger

The debugger overlay object.

@:value(true)filtersEnabled:Bool = true

Enables or disables the filters set via setFilters().

@:value(10)focusLostFramerate:Int = 10

Framerate to use on focus lost. Default is 10.

@:value(false)@:allow(flixel.system.frontEnds.VCRFrontEnd)read onlyrecording:Bool = false

Flag for whether a new recording is being made.

@:value(false)@:allow(flixel.system.frontEnds.VCRFrontEnd)read onlyreplaying:Bool = false

Flag for whether a replay is currently playing.

read onlysoundTray:FlxSoundTray

The sound tray display container.

@:value(0)read onlyticks:Int = 0

Time in milliseconds that has passed (amount of "ticks" passed) since the game has started.

Methods

setFilters(filters:Array<BitmapFilter>):Void

Sets the filter array to be applied to the game.

Inherited Variables

Defined by Sprite

@:flash.propertybuttonMode:Bool

@:flash.propertyread onlydropTarget:DisplayObject

@:flash.propertyread onlygraphics:Graphics

@:flash.propertyhitArea:Sprite

@:flash.propertyuseHandCursor:Bool

Defined by DisplayObjectContainer

@:flash.propertymouseChildren:Bool

@:flash.propertyread onlynumChildren:Int

@:flash.propertytabChildren:Bool

@:flash.propertyread onlytextSnapshot:TextSnapshot

Defined by InteractiveObject

@:flash.propertycontextMenu:ContextMenu

@:flash.propertydoubleClickEnabled:Bool

@:flash.propertyfocusRect:Dynamic

@:flash.propertymouseEnabled:Bool

@:flash.property@:require(flash11)needsSoftKeyboard:Bool

@:flash.property@:require(flash11)softKeyboardInputAreaOfInterest:Rectangle

@:flash.propertytabEnabled:Bool

@:flash.propertytabIndex:Int

Defined by DisplayObject

@:flash.propertyalpha:Float

@:flash.propertyblendMode:BlendMode

@:flash.property@:require(flash10)write onlyblendShader:Shader

@:flash.propertycacheAsBitmap:Bool

@:flash.propertycacheAsBitmapMatrix:Matrix

@:flash.propertyfilters:Array<BitmapFilter>

@:flash.propertyheight:Float

@:flash.propertyread onlyloaderInfo:LoaderInfo

@:flash.propertymask:DisplayObject

@:flash.propertyread onlymouseX:Float

@:flash.propertyread onlymouseY:Float

@:flash.propertyname:String

@:flash.propertyopaqueBackground:Null<UInt>

@:flash.propertyread onlyparent:DisplayObjectContainer

@:flash.propertyread onlyroot:DisplayObject

@:flash.propertyrotation:Float

@:flash.property@:require(flash10)rotationX:Float

@:flash.property@:require(flash10)rotationY:Float

@:flash.property@:require(flash10)rotationZ:Float

@:flash.propertyscale9Grid:Rectangle

@:flash.propertyscaleX:Float

@:flash.propertyscaleY:Float

@:flash.property@:require(flash10)scaleZ:Float

@:flash.propertyscrollRect:Rectangle

@:flash.propertyshader:Shader

@:flash.propertyread onlystage:Stage

@:flash.propertytransform:Transform

@:flash.propertyvisible:Bool

@:flash.propertywidth:Float

@:flash.propertyx:Float

@:flash.propertyy:Float

@:flash.property@:require(flash10)z:Float

Inherited Methods

Defined by Sprite

@:value({ bounds : null, lockCenter : false })startDrag(lockCenter:Bool = false, ?bounds:Null<Rectangle>):Void

@:value({ bounds : null, lockCenter : false })@:require(flash10_1)startTouchDrag(touchPointID:Int, lockCenter:Bool = false, ?bounds:Null<Rectangle>):Void

@:require(flash10_1)stopTouchDrag(touchPointID:Int):Void

Defined by DisplayObjectContainer

Defined by InteractiveObject

@:require(flash11)requestSoftKeyboard():Bool

Defined by DisplayObject

getBounds(targetCoordinateSpace:DisplayObject):Rectangle

getRect(targetCoordinateSpace:DisplayObject):Rectangle

@:require(flash10)globalToLocal3D(point:Point):Vector3D

@:value({ shapeFlag : false })hitTestPoint(x:Float, y:Float, shapeFlag:Bool = false):Bool

@:require(flash10)local3DToGlobal(point3d:Vector3D):Point

Defined by EventDispatcher

@:value({ useWeakReference : false, priority : 0, useCapture : false })addEventListener<T>(type:EventType<T>, listener:T ‑> Void, useCapture:Bool = false, priority:Int = 0, useWeakReference:Bool = false):Void

@:value({ useCapture : false })removeEventListener<T>(type:EventType<T>, listener:T ‑> Void, useCapture:Bool = false):Void