Class GfxAppAbstract

The base class for a GopherGfx application.

Hierarchy

  • GfxApp

Constructors

  • Constructor for the GfxApp class

    Parameters

    • enableStencilBuffer: boolean = false

      Boolean value to enable/disable the stencil buffer

    Returns GfxApp

Properties

assetManager: AssetManager

Coordinates asynchronous loading of external assets.

camera: Camera

The camera used by the GfxApp instance.

paused: boolean

A boolean indicating whether the GfxApp is currently paused.

previousTouches: Vector2[]

An array of the previous touches on the touch screen.

renderer: Renderer

The renderer used by the GfxApp instance.

runInBackground: boolean

A boolean indicating whether the GfxApp should continue to run in the background.

scene: Scene

The scene used by the GfxApp instance.

time: number

The current game time in seconds.

instance: GfxApp

The singleton instance of the GfxApp class.

Methods

  • Abstract method to be implemented by any subclass of GfxApp. Creates the scene for the application.

    Returns void

  • Converts mouse coordinates to normalized device coordinates

    Returns

    The normalized device coordinates

    Parameters

    • mouseX: number

      The x coordinate of the mouse

    • mouseY: number

      The y coordinate of the mouse

    Returns Vector2

  • Initialization loop for loading assets before starting the main loop

    Returns void

  • Returns true if the application is paused

    Returns

    True if the application is paused, false otherwise

    Returns boolean

  • Late update method to be called just before drawing the scene. Optional method - subclasses do not need to override it.

    Parameters

    • deltaTime: number

      Time elapsed since the last update call (in seconds)

    Returns void

  • Method called after all assets are loaded before entering main loop. Optional method - subclasses do not need to override it.

    Returns void

  • Handles focus events to pause and resume the application

    Parameters

    • event: FocusEvent

      The FocusEvent

    Returns void

  • Handles focus events to pause and resume the application

    Parameters

    • event: FocusEvent

      The FocusEvent

    Returns void

  • Method called when a key is pressed. Subclasses can override this method to handle the event.

    Parameters

    • event: KeyboardEvent

      The KeyboardEvent object associated with the key press

    Returns void

  • Method called when a key is released. Subclasses can override this method to handle the event.

    Parameters

    • event: KeyboardEvent

      The KeyboardEvent object associated with the key release

    Returns void

  • Method called when the mouse is clicked. Subclasses can override this method to handle the event.

    Parameters

    • event: MouseEvent

      The MouseEvent object associated with the mouse click

    Returns void

  • Method called when the mouse is moved. Subclasses can override this method to handle the event.

    Parameters

    • event: MouseEvent

      The MouseEvent object associated with the mouse movement

    Returns void

  • Method called when the mouse is released. Subclasses can override this method to handle the event.

    Parameters

    • event: MouseEvent

      The MouseEvent object associated with the mouse release

    Returns void

  • Method called when the mouse wheel is moved. Subclasses can override this method to handle the event.

    Parameters

    • event: WheelEvent

      The WheelEvent object associated with the mouse wheel movement

    Returns void

  • Creates a simulated mouse up event for touch input

    Parameters

    • event: TouchEvent

    Returns void

  • Creates a simulated mouse move event for touch input

    Parameters

    • event: TouchEvent

    Returns void

  • Creates a simulated mouse down event for touch input

    Parameters

    • event: TouchEvent

    Returns void

  • Simulates a mouse event from a given TouchEvent

    Parameters

    • type: string

      The type of mouse event to simulate

    • touchEvent: TouchEvent

      The touch event to use for simulating the mouse event

    Returns void

  • Simulates a mouse wheel event from a given TouchEvent

    Parameters

    • touchEvent: TouchEvent

      The touch event to use for simulating the wheel event

    Returns void

  • Abstract method to be implemented by any subclass of GfxApp. Updates the application's state with the given deltaTime.

    Parameters

    • deltaTime: number

      Time elapsed since the last update call (in seconds)

    Returns void

  • Gets the singleton instance of the GfxApp class.

    Returns

    The singleton instance of the GfxApp class.

    Returns GfxApp

Generated using TypeDoc