Class Game
The MonoGame implementation of the SadConsole Game Host.
Implements
Inherited Members
Namespace: SadConsole
Assembly: SadConsole.Host.MonoGame.dll
Syntax
public sealed class Game : GameHost, IDisposable
Properties
Instance
Strongly typed version of Instance.
Declaration
public static Game Instance { get; set; }
Property Value
Type | Description |
---|---|
Game |
MonoGameInstance
The Microsoft.Xna.Framework.Game instance.
Declaration
public Game MonoGameInstance { get; }
Property Value
Type | Description |
---|---|
Game |
Methods
Create()
Creates a new game with an 80x25 console that uses the default SadConsole IBM font.
Declaration
public static void Create()
Create(Builder)
Creates a new game and assigns it to the MonoGameInstance property.
Declaration
public static void Create(Builder configuration)
Parameters
Type | Name | Description |
---|---|---|
Builder | configuration | The settings used in creating the game. |
Create(int, int)
Creates a new game with an initialization callback and a console set to the specific cell count that uses the default SadConsole IBM font.
Declaration
public static void Create(int cellCountX, int cellCountY)
Parameters
Type | Name | Description |
---|---|---|
int | cellCountX | The width of the screen, in cells. |
int | cellCountY | The height of the screen, in cells. |
Create(int, int, EventHandler<GameHost>)
Creates a new game with an initialization callback and a console set to the specific cell count that uses the specified font.
Declaration
public static void Create(int cellCountX, int cellCountY, EventHandler<GameHost> gameStarted)
Parameters
Type | Name | Description |
---|---|---|
int | cellCountX | The width of the screen, in cells. |
int | cellCountY | The height of the screen, in cells. |
EventHandler<GameHost> | gameStarted | An event handler to be invoked when the game starts. |
Create(int, int, string, EventHandler<GameHost>)
Creates a new game with the specific screen size, and an initialization callback. Loads the specified font as the default.
Declaration
public static void Create(int cellCountX, int cellCountY, string font, EventHandler<GameHost> gameStarted)
Parameters
Type | Name | Description |
---|---|---|
int | cellCountX | The width of the screen, in cells. |
int | cellCountY | The height of the screen, in cells. |
string | font | The font file to load. |
EventHandler<GameHost> | gameStarted | An event handler to be invoked when the game starts. |
CreateTexture(int, int)
Creates a texture.
Declaration
public override ITexture CreateTexture(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the texture in pixels. |
int | height | The height of the texture in pixels. |
Returns
Type | Description |
---|---|
ITexture | The texture from the game host. |
Overrides
GetKeyboardState()
Gets the state of the keyboard from the implemented host.
Declaration
public override IKeyboardState GetKeyboardState()
Returns
Type | Description |
---|---|
IKeyboardState | The state of the keyboard. |
Overrides
GetMouseState()
Gets the state of the mouse from the implemented host.
Declaration
public override IMouseState GetMouseState()
Returns
Type | Description |
---|---|
IMouseState | The state of the mouse. |
Overrides
GetTexture(Stream)
Gets a texture from the implemented host.
Declaration
public override ITexture GetTexture(Stream textureStream)
Parameters
Type | Name | Description |
---|---|---|
Stream | textureStream | A stream containing the texture. |
Returns
Type | Description |
---|---|
ITexture | The texture from the game host. |
Overrides
GetTexture(string)
Gets a texture from the implemented host.
Declaration
public override ITexture GetTexture(string resourcePath)
Parameters
Type | Name | Description |
---|---|---|
string | resourcePath | The path to the texture to load. |
Returns
Type | Description |
---|---|
ITexture | The texture from the game host. |
Overrides
OpenStream(string, FileMode, FileAccess)
Opens a read-only stream with MonoGame.
Declaration
public override Stream OpenStream(string file, FileMode mode = FileMode.Open, FileAccess access = FileAccess.Read)
Parameters
Type | Name | Description |
---|---|---|
string | file | The file to open. |
FileMode | mode | Unused by monogame. |
FileAccess | access | Unused by monogame. |
Returns
Type | Description |
---|---|
Stream | The stream. |
Overrides
ResizeWindow(int, int, bool)
Resizes the window to the specified dimensions.
Declaration
public override void ResizeWindow(int width, int height, bool resizeOutputSurface = false)
Parameters
Type | Name | Description |
---|---|---|
int | width | The width of the window in pixels. |
int | height | The height of the window in pixels. |
bool | resizeOutputSurface | When true resizes the screen output surface along with the window. Defaults to false |
Overrides
Run()
Runs the game.
Declaration
public override void Run()
Overrides
ToggleFullScreen()
Toggles between windowed and full screen rendering for SadConsole.
Declaration
public void ToggleFullScreen()