IGameContext
Declaration
public interface Strawberry.Core.IGameContext
Represents the context of a game, providing access to essential components and lifecycle methods for initialization, updating, and rendering. You should implement this interface in your game and launch it using Game class's Run method.
Properties
Width abstract
Gets the width of the game context.
int Width { get }
Height abstract
Gets the height of the game context.
int Height { get }
GraphicsContext abstract
Gets the graphics context used for rendering.
IGraphicsContext GraphicsContext { get }
InputManager abstract
Gets the input manager for handling user input.
IInputManager InputManager { get }
SoundManager abstract
Gets the sound manager for handling audio playback.
ISoundManager SoundManager { get }
Storage abstract
IStorage Storage { get }
Methods
OnInitialize abstract
Called during the initialization phase of the game.
void OnInitialize(IGameLauncher launcher)
Parameters:
| Name | Type | Description |
|---|---|---|
launcher |
Strawberry.IGameLauncher |
The game launcher used to initialize the game. |
OnBeginUpdate abstract
Called at the beginning of the update phase.
bool OnBeginUpdate()
Returns: True if the update phase should proceed; otherwise, false.
OnUpdate abstract
Called during the update phase to update game logic.
void OnUpdate()
OnFixedUpdate abstract
Called during the fixed update phase for physics or time-sensitive updates.
void OnFixedUpdate()
OnEndUpdate abstract
Called at the end of the update phase.
void OnEndUpdate()
OnBeginRender abstract
Called at the beginning of the render phase.
bool OnBeginRender()
Returns: True if the render phase should proceed; otherwise, false.
OnRender abstract
Called during the render phase to draw the game.
void OnRender()
OnEndRender abstract
Called at the end of the render phase.
void OnEndRender()