Show / Hide Table of Contents

Class Extensions

Extensions to the Builder type.

Inheritance
object
Extensions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole.Configuration
Assembly: SadConsole.dll
Syntax
public static class Extensions

Methods

AddFrameRenderEvent(Builder, EventHandler<GameHost>)

Sets an event handler for the FrameRender event.

Declaration
public static Builder AddFrameRenderEvent(this Builder configBuilder, EventHandler<GameHost> instance_FrameRender)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

EventHandler<GameHost> instance_FrameRender

The event handler

Returns
Type Description
Builder

The configuration builder.

AddFrameUpdateEvent(Builder, EventHandler<GameHost>)

Sets an event handler for the FrameUpdate event.

Declaration
public static Builder AddFrameUpdateEvent(this Builder configBuilder, EventHandler<GameHost> instance_FrameUpdate)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

EventHandler<GameHost> instance_FrameUpdate

The event handler

Returns
Type Description
Builder

The configuration builder.

ConfigureFonts(Builder, Action<FontConfig, GameHost>)

Configures which default font to use during game startup, as well as which other fonts to load for the game.

Declaration
public static Builder ConfigureFonts(this Builder configBuilder, Action<FontConfig, GameHost> fontLoader)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

Action<FontConfig, GameHost> fontLoader

A method that provides access to the FontConfig object that loads fonts.

Returns
Type Description
Builder

The configuration builder.

ConfigureFonts(Builder, bool)

Configures SadConsole to use the built in default fonts.

Declaration
public static Builder ConfigureFonts(this Builder configBuilder, bool useExtendedDefault = false)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

bool useExtendedDefault

When true, SadConsole sets the default font to EmbeddedFontExtended; otherwise EmbeddedFont is used.

Returns
Type Description
Builder

The configuration builder.

ConfigureFonts(Builder, string, string[]?)

Configures SadConsole to use the specified font file as the default font.

Declaration
public static Builder ConfigureFonts(this Builder configBuilder, string customDefaultFont, string[]? extraFonts = null)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

string customDefaultFont

Creates the font config for SadConsole using this font file as the default.

string[] extraFonts

Extra fonts to load into SadConsole.

Returns
Type Description
Builder

The configuration builder.

FixOldFontName(Builder)

Adds the embedded fonts to the font dictionary with the old incorrect name.

Declaration
public static Builder FixOldFontName(this Builder configBuilder)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

Returns
Type Description
Builder

The configuration builder.

IsStartingScreenFocused(Builder, bool)

Either focuses or unfocuses the starting screen.

Declaration
public static Builder IsStartingScreenFocused(this Builder configBuilder, bool value)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

bool value

Indicates whether or not Screen is focused.

Returns
Type Description
Builder

The configuration builder.

OnEnd(Builder, EventHandler<GameHost>)

Sets an event handler for the Ending event.

Declaration
public static Builder OnEnd(this Builder configBuilder, EventHandler<GameHost> instance_Ending)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

EventHandler<GameHost> instance_Ending

The event handler

Returns
Type Description
Builder

The configuration builder.

OnStart(Builder, EventHandler<GameHost>)

Sets an event handler for the Started event.

Declaration
public static Builder OnStart(this Builder configBuilder, EventHandler<GameHost> instance_Started)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

EventHandler<GameHost> instance_Started

The event handler

Returns
Type Description
Builder

The configuration builder.

SetScreenSize(Builder, int, int)

Sets the initial screen size of the window, in cells.

Declaration
public static Builder SetScreenSize(this Builder configBuilder, int width, int height)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

int width

The cell count along the x-axis.

int height

The cell count along the y-axis.

Returns
Type Description
Builder

The configuration builder.

SetSplashScreen(Builder, Func<GameHost, ScreenSurface[]>)

Sets the startup splash screens to the array returned by the creator delegate.

Declaration
public static Builder SetSplashScreen(this Builder configBuilder, Func<GameHost, ScreenSurface[]> creator)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

Func<GameHost, ScreenSurface[]> creator

A delegate that returns an array of surface objects.

Returns
Type Description
Builder

The configuration builder.

SetSplashScreen<TSplashScreen>(Builder)

Sets the startup splash screen to the specified object.

Declaration
public static Builder SetSplashScreen<TSplashScreen>(this Builder configBuilder) where TSplashScreen : IScreenSurface, new()
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

Returns
Type Description
Builder

The configuration builder.

Type Parameters
Name Description
TSplashScreen

A parameterless IScreenSurface object.

SetStartingScreen(Builder, Func<GameHost, IScreenObject>)

Sets the Screen property to the return value of the creator parameter.

Declaration
public static Builder SetStartingScreen(this Builder configBuilder, Func<GameHost, IScreenObject> creator)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

Func<GameHost, IScreenObject> creator

A method that returns an object as the starting screen.

Returns
Type Description
Builder

The configuration builder.

SetStartingScreen<TRootObject>(Builder)

Sets the Screen property to the specified type.

Declaration
public static Builder SetStartingScreen<TRootObject>(this Builder configBuilder) where TRootObject : IScreenObject, new()
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

Returns
Type Description
Builder

The configuration builder.

Type Parameters
Name Description
TRootObject

A parameterless IScreenObject object.

UseDefaultConsole(Builder)

Sets the StartingConsole and Screen properties to new console when the game starts.

Declaration
public static Builder UseDefaultConsole(this Builder configBuilder)
Parameters
Type Name Description
Builder configBuilder

The builder object that composes the game startup.

Returns
Type Description
Builder

The configuration builder.

In this article

Back to top

Back to top Generated by DocFX