FlxGame
| Kind | class |
| Package | flixel |
| Full name | flixel.FlxGame |
| Source | source/source-haxelib-patches/flixel/FlxGame.hx |
| Extends | Sprite |
| Metadata | @:allow(flixel.FlxG) |
Known subclasses: FunkinGame
Public fields
| Name | Type | Static | Default | Notes |
|---|---|---|---|---|
focusLostFramerate | Int | no | 10 | Framerate to use on focus lost. Default is 10. |
soundTray | FlxSoundTray | no | — | property (default, null) · #if FLX_SOUND_TRAY · The sound tray display container. |
debugger | FlxDebugger | no | — | property (default, null) · #if FLX_DEBUG · The debugger overlay object. |
ticks | Float | no | 0 | property (default, null) · Time in milliseconds that has passed (amount of "ticks" passed) since the game has started. |
filtersEnabled | Bool | no | true | Enables 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
| Parameter | Type | Default |
|---|---|---|
gameWidth (optional) | Dynamic | 0 |
gameHeight (optional) | Dynamic | 0 |
initialState (optional) | InitialState | — |
updateFramerate (optional) | Dynamic | 60 |
drawFramerate (optional) | Dynamic | 60 |
skipSplash (optional) | Dynamic | false |
startFullscreen (optional) | Dynamic | false |
setFilters
function setFilters(filters:Array<BitmapFilter>):Void
Sets the filter array to be applied to the game.
| Parameter | Type | Default |
|---|---|---|
filters | Array<BitmapFilter> | — |
Internals
Private / internal members
| Field | Type | Static |
|---|---|---|
_gameJustStarted | Bool | no |
_initialState | NextState | no |
_state | FlxState | no |
_isPlayState | Bool | no |
_total | Float | no |
_startTime | Float | no |
_startCounter | Float | no |
_accumulator | Float | no |
_elapsedMS | Float | no |
_stepMS | Float | no |
_stepSeconds | Float | no |
_maxAccumulation | Float | no |
_lostFocus | Bool | no |
_filters | Array<BitmapFilter> | no |
_onFocusFiredOnce | Bool | no |
_focusLostScreen | FlxFocusLostScreen | no |
_inputContainer | Sprite | no |
_customSoundTray | Class<FlxSoundTray> | no |
_customFocusLostScreen | Class<FlxFocusLostScreen> | no |
_skipSplash | Bool | no |
_startFullscreen | Bool | no |
_nextState | NextState | no |
_resetGame | Bool | no |
postProcessLayer | Sprite | no |
postProcesses | Array<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 |