Skip to main content

FlxGame

Kindclass
Packageflixel
Full nameflixel.FlxGame
Sourcesource/source-haxelib-patches/flixel/FlxGame.hx
ExtendsSprite
Metadata@:allow(flixel.FlxG)

Known subclasses: FunkinGame

Public fields​

NameTypeStaticDefaultNotes
focusLostFramerateIntno10Framerate to use on focus lost. Default is 10.
soundTrayFlxSoundTrayno—property (default, null) · #if FLX_SOUND_TRAY · The sound tray display container.
debuggerFlxDebuggerno—property (default, null) · #if FLX_DEBUG · The debugger overlay object.
ticksFloatno0property (default, null) · Time in milliseconds that has passed (amount of "ticks" passed) since the game has started.
filtersEnabledBoolnotrueEnables or disables the filters set via setFilters().

Public methods​

new (constructor)​

function new(gameWidth = 0, gameHeight = 0, ?initialState:InitialState, updateFramerate = 60, drawFramerate = 60, skipSplash = false, startFullscreen = false)

Instantiate a new game object.

@param 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. @param 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. @param initialState A constructor for the initial state, ex: PlayState.new or ()->new PlayState(). Note: Also allows Class<FlxState> for backwards compatibility. @param updateFramerate How frequently the game should update. Default is 60 fps. @param drawFramerate Sets the actual display / draw framerate for the game. Default is 60 fps. @param skipSplash Whether you want to skip the flixel splash screen with FLX_NO_DEBUG. @param startFullscreen Whether to start the game in fullscreen mode (desktop targets only).

@see scale modes

ParameterTypeDefault
gameWidth (optional)Dynamic0
gameHeight (optional)Dynamic0
initialState (optional)InitialState—
updateFramerate (optional)Dynamic60
drawFramerate (optional)Dynamic60
skipSplash (optional)Dynamicfalse
startFullscreen (optional)Dynamicfalse

View source

setFilters​

function setFilters(filters:Array<BitmapFilter>):Void

Sets the filter array to be applied to the game.

ParameterTypeDefault
filtersArray<BitmapFilter>—

View source

Internals​

Private / internal members
FieldTypeStatic
_gameJustStartedBoolno
_initialStateNextStateno
_stateFlxStateno
_isPlayStateBoolno
_totalFloatno
_startTimeFloatno
_startCounterFloatno
_accumulatorFloatno
_elapsedMSFloatno
_stepMSFloatno
_stepSecondsFloatno
_maxAccumulationFloatno
_lostFocusBoolno
_filtersArray<BitmapFilter>no
_onFocusFiredOnceBoolno
_focusLostScreenFlxFocusLostScreenno
_inputContainerSpriteno
_customSoundTrayClass<FlxSoundTray>no
_customFocusLostScreenClass<FlxFocusLostScreen>no
_skipSplashBoolno
_startFullscreenBoolno
_nextStateNextStateno
_resetGameBoolno
postProcessLayerSpriteno
postProcessesArray<PostProcess>no
Method
function create(_):Void
function onFocus(_):Void
function onFocusLost(event:Event):Void
function onResize(_):Void
function resizeGame(width:Int, height:Int):Void
function onEnterFrame(_):Void
inline function resetGame():Void
function switchState():Void
function gameStart():Void
function step():Void
function update():Void
function updateElapsed():Void
function updateInput():Void
function draw():Void
inline function getTicks()
function getTimer():Float