Class Game
- Namespace
- Axolotl2D
- Assembly
- Axolotl2D.dll
Represents the base game class for Axolotl2D.
public abstract class Game : IDisposable
- Inheritance
-
Game
- Implements
- Inherited Members
Constructors
Game(IServiceProvider, int, int)
Construct a new game.
public Game(IServiceProvider serviceProvider, int maxDrawRate = 120, int maxUpdateRate = 120)
Parameters
serviceProviderIServiceProviderService provider to relay.
maxDrawRateintMaximum frame rate.
maxUpdateRateintMaximum update rate.
Properties
ClearColor
Represents the clear color of the game.
public Color ClearColor { get; set; }
Property Value
CurrentFramerate
Represents the current framerate of the game.
public double CurrentFramerate { get; }
Property Value
LastDrawMilliseconds
Time spent producing the previous completed frame, in milliseconds.
public double LastDrawMilliseconds { get; }
Property Value
LastUpdateMilliseconds
Time spent in update callbacks during the previous update, in milliseconds.
public double LastUpdateMilliseconds { get; }
Property Value
Title
The window title.
public string Title { get; set; }
Property Value
Viewport
The current Viewport of the game.
public Vector2 Viewport { get; set; }
Property Value
Methods
Cleanup()
Event that gets called when the game attempts to clean up.
protected abstract void Cleanup()
Dispose()
Disposes the game.
public void Dispose()
GetKeyboard()
Gets the keyboard input helper.
public IKeyboard? GetKeyboard()
Returns
- IKeyboard
Keyboard input helper.
GetMouse()
Gets the mouse input helper.
public IMouse? GetMouse()
Returns
- IMouse
Mouse input helper.
InitializeAsync(CancellationToken)
Loads application resources before the window and scene start.
protected virtual Task InitializeAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenStops startup resource loading.
Returns
Events
OnDraw
Called when the game draws.
public event Game.DrawDelegate? OnDraw
Event Type
OnLoad
Called after the window, renderer, and input initialize. Keep handlers synchronous; override InitializeAsync(CancellationToken) for awaited startup work.
public event Game.LoadDelegate? OnLoad
Event Type
OnResize
Called when the game window resizes.
public event Game.ResizeDelegate? OnResize
Event Type
OnUpdate
Called when the game updates.
public event Game.UpdateDelegate? OnUpdate