Class Game
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
FreeCPUResources
Determines whether CPU resources should be freed after loading assets.
public bool FreeCPUResources { get; set; }
Property Value
RenderDevice
The render device for rendering graphics.
public IRenderDevice RenderDevice { get; set; }
Property Value
Services
The service container for managing services.
public ServiceContainer Services { get; set; }
Property Value
TargetFrameRate
The target frame rate for the game.
public int TargetFrameRate { get; set; }
Property Value
Viewport
The viewport defining the rendering area.
public Viewport Viewport { get; set; }
Property Value
Window
The main application window.
public Window Window { get; set; }
Property Value
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
rendererIRenderDevice
LoadContent(AssetManager)
Loads game content and assets.
public abstract void LoadContent(AssetManager assets)
Parameters
assetsAssetManager
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
renderDeviceIRenderDevicewidthintheightinttitlestringuseVsyncboolwindowStateWindow.WindowState
Update(float)
Updates the game state based on the elapsed time since the last frame.
public abstract void Update(float deltaTime)
Parameters
deltaTimefloat