Table of Contents

Class Game

Namespace
LibGFX.Core
Assembly
LibGFX.dll

Base class for creating a game application.

public abstract class Game
Inheritance
Game
Inherited Members

Constructors

Game()

Initializes a new instance of the Game class.

protected Game()

Properties

AssetManager

The asset manager for managing assets.

public AssetManager AssetManager { get; set; }

Property Value

AssetManager

FreeCPUResources

Determines whether CPU resources should be freed after loading assets.

public bool FreeCPUResources { get; set; }

Property Value

bool

RenderDevice

The render device for rendering graphics.

public IRenderDevice RenderDevice { get; set; }

Property Value

IRenderDevice

Services

The service container for managing services.

public ServiceContainer Services { get; set; }

Property Value

ServiceContainer

TargetFrameRate

The target frame rate for the game.

public int TargetFrameRate { get; set; }

Property Value

int

Viewport

The viewport defining the rendering area.

public Viewport Viewport { get; set; }

Property Value

Viewport

Window

The main application window.

public Window Window { get; set; }

Property Value

Window

Methods

Dispose()

Disposes of game resources and performs cleanup.

public abstract void Dispose()

Initialize(IRenderDevice)

Initializes game elements and state.

public abstract void Initialize(IRenderDevice renderer)

Parameters

renderer IRenderDevice

LoadContent(AssetManager)

Loads game content and assets.

public abstract void LoadContent(AssetManager assets)

Parameters

assets AssetManager

OnFrameEnd()

Called at the end of each frame for any necessary cleanup or state updates.

public abstract void OnFrameEnd()

OnStart()

Called when the game starts.

public abstract void OnStart()

Render()

Renders the current frame.

public abstract void Render()

Run(IRenderDevice, int, int, string, bool, WindowState)

Runs the game application with the specified parameters.

public void Run(IRenderDevice renderDevice, int width = 800, int height = 600, string title = "LibGFX Application", bool useVsync = true, Window.WindowState windowState = WindowState.Normal)

Parameters

renderDevice IRenderDevice
width int
height int
title string
useVsync bool
windowState Window.WindowState

Update(float)

Updates the game state based on the elapsed time since the last frame.

public abstract void Update(float deltaTime)

Parameters

deltaTime float