Interface IGame
- Namespace
- BSGameLib.Game
- Assembly
- BSGameLib.Game.dll
The running game, as its components and services see it.
public interface IGame
Properties
ContentManager
Loads and caches the game's textures and fonts.
IContentManager ContentManager { get; }
Property Value
DisplayController
Controls VSync and fullscreen for the game's window.
IDisplayController DisplayController { get; }
Property Value
Graphics2D
Begins the encoders that sprites, shapes and text are drawn through.
IGraphics2D Graphics2D { get; }
Property Value
RenderSurface
The render surface the frame is drawn on.
IRenderSurface RenderSurface { get; }
Property Value
ShaderManager
Registers the game's materials and loads its shader programs.
ShaderManager ShaderManager { get; }
Property Value
ShapeRenderer
The renderer that draws shapes.
ShapeRenderer ShapeRenderer { get; }
Property Value
Methods
AddComponent(Component)
Adds component, so that its update and draw run each frame when it has them.
void AddComponent(Component component)
Parameters
componentComponent
Exceptions
- InvalidOperationException
The services have not been built yet, which happens when Run() builds them.
Exit()
Stops the game loop.
void Exit()
GetComponent<TComponent>()
Returns the first added component of type TComponent, or null when there is none.
TComponent GetComponent<TComponent>() where TComponent : Component
Returns
- TComponent
Type Parameters
TComponent
GetService<TService>()
Returns the service of type TService, or null when it is not registered.
TService GetService<TService>()
Returns
- TService
Type Parameters
TService
Exceptions
- InvalidOperationException
The services have not been built yet, which happens when Run() builds them.
RemoveComponent(Component)
Removes component, which was added with AddComponent(Component). Does nothing when it was not added.
void RemoveComponent(Component component)
Parameters
componentComponent