Search Results for

    Show / Hide Table of Contents

    Class Engine

    The main engine class.

    Inheritance
    Engine
    Assembly: FlaxEngine.dll
    File: Engine/Engine/Engine.h
    Syntax
    public class Engine

    Fields

    Draw

    Event called during frame rendering and can be used to invoke custom rendering with GPUDevice.

    Declaration
    public static Action Draw
    Field Value
    Action

    ExitCode

    The current process exit code (pending to return).

    Declaration
    public static int32 ExitCode
    Field Value
    int32

    FatalError

    The current state of the fatal error. Set to None if no error occurred yet.

    Declaration
    public static FatalErrorType FatalError
    Field Value
    FatalErrorType

    FixedUpdate

    Event called on engine fixed update.

    Declaration
    public static Action FixedUpdate
    Field Value
    Action

    FrameCount

    Gets the current frame (drawing) count since the start of the game.

    Declaration
    public static uint64 FrameCount
    Field Value
    uint64

    HasFocus

    True if app has focus (one of the windows is being focused).

    Declaration
    public static bool HasFocus
    Field Value
    bool

    IsRequestingExit

    Flags set to true if engine needs to be closed (exit is pending). Use FatalError to determinate the exit reason (specific error or normal shutdown).

    Declaration
    public static bool IsRequestingExit
    Field Value
    bool

    LateFixedUpdate

    Event called after engine update.

    Declaration
    public static Action LateFixedUpdate
    Field Value
    Action

    LateUpdate

    Event called after engine update.

    Declaration
    public static Action LateUpdate
    Field Value
    Action

    MainWindow

    Declaration
    public static Window* MainWindow
    Field Value
    Window

    Pause

    Event called during game loop when application gets paused (engine tick will be postponed until unpause). Used on platforms that support only one app on screen.

    Declaration
    public static Action Pause
    Field Value
    Action

    ReportCrash

    The custom handler for engine crash handling and reporting. Can be used to override default message box with a custom one or send crash report to telemetry service. Args are: error message and context pointer (for stack-trace access).

    Declaration
    public static Delegate<StringView, void* > ReportCrash
    Field Value
    Delegate<StringView, void >

    RequestingExit

    Event called when the engine is requesting exit.

    Declaration
    public static Action RequestingExit
    Field Value
    Action

    StartupTime

    The engine start time (local time).

    Declaration
    public static DateTime StartupTime
    Field Value
    DateTime

    Unpause

    Event called during game loop when application gets unpaused (engine tick will continue). Used on platforms that support only one app on screen.

    Declaration
    public static Action Unpause
    Field Value
    Action

    Update

    Event called on engine update.

    Declaration
    public static Action Update
    Field Value
    Action

    UpdateCount

    Gets the current update counter since the start of the game.

    Declaration
    public static uint64 UpdateCount
    Field Value
    uint64

    UpdateGraph

    Task graph for engine update.

    Declaration
    public static TaskGraph* UpdateGraph
    Field Value
    TaskGraph

    Methods

    Exit(int32 exitCode=-1, FatalErrorType error=FatalErrorType::None)

    Exits the engine.

    Declaration
    public static void Exit(int32 exitCode=-1, FatalErrorType error=FatalErrorType::None)
    Parameters
    int32 exitCode

    The exit code.

    FatalErrorType error

    The fatal error type (or None on graceful exit).

    FocusGameViewport()

    Brings focused to the game viewport (game can receive input).

    Declaration
    public static void FocusGameViewport()

    GetCommandLine()

    Gets the application command line arguments.

    Declaration
    public static String GetCommandLine()
    Returns
    String

    GetCustomSettings(const StringView& key)

    Gets the custom game settings asset referenced by the given key.

    Declaration
    public static JsonAsset* GetCustomSettings(const StringView& key)
    Parameters
    StringView key

    The settings key.

    Returns
    JsonAsset

    The returned asset. Returns null if key is invalid, cannot load asset or data is missing.

    GetFramesPerSecond()

    Gets the amount of frames rendered during last second known as Frames Per Second. User scripts updates or fixed updates for physics may run at a different frequency than scene rendering. Use this property to get an accurate amount of frames rendered during the last second.

    Declaration
    public static int32 GetFramesPerSecond()
    Returns
    int32

    HasGameViewportFocus()

    Checks whenever the game viewport is focused by the user (eg. can receive input).

    Declaration
    public static bool HasGameViewportFocus()
    Returns
    bool

    IsEditor()

    Returns true if the game is running in the Flax Editor; false if run from any deployment target. Use this property to perform Editor-related actions.

    Declaration
    public static bool IsEditor()
    Returns
    bool

    IsHeadless()

    Declaration
    public static bool IsHeadless()
    Returns
    bool

    IsReady()

    Declaration
    public static bool IsReady()
    Returns
    bool

    Main(const Char* cmdLine)

    The main engine function (must be called from platform specific entry point).

    Declaration
    public static int32 Main(const Char* cmdLine)
    Parameters
    Char cmdLine

    The input application command line arguments.

    Returns
    int32

    The application exit code.

    OnDraw()

    Draw callback.

    Declaration
    public static void OnDraw()

    OnExit()

    Called when engine exists. Disposes engine services and shuts down the engine.

    Declaration
    public static void OnExit()

    OnFixedUpdate()

    Fixed update callback used by the physics simulation (fixed stepping).

    Declaration
    public static void OnFixedUpdate()

    OnLateFixedUpdate()

    Late fixed update callback.

    Declaration
    public static void OnLateFixedUpdate()

    OnLateUpdate()

    Late update callback.

    Declaration
    public static void OnLateUpdate()

    OnUpdate()

    Updates game and all engine services.

    Declaration
    public static void OnUpdate()

    RequestExit(int32 exitCode = 0, FatalErrorType error=FatalErrorType::None)

    Requests normal engine exit.

    Declaration
    public static void RequestExit(int32 exitCode = 0, FatalErrorType error=FatalErrorType::None)
    Parameters
    int32 exitCode

    The exit code.

    FatalErrorType error

    The fatal error type (or None on graceful exit).

    ShouldExit()

    Declaration
    public static bool ShouldExit()
    Returns
    bool

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat