Table of Contents

Class GameBase

Namespace
AlphaFramework.Presentation
Assembly
AlphaFramework.Presentation.dll

Base class for building a game using AlphaFramework. Handles basic engine and GUI setup.

public abstract class GameBase : RenderHost, IDisposable
Inheritance
GameBase
Implements
Derived
Inherited Members
Extension Methods

Constructors

GameBase(SettingsBase, string, Icon?, Image?, bool)

Base class for building a game using AlphaFramework. Handles basic engine and GUI setup.

protected GameBase(SettingsBase settings, string name, Icon? icon = null, Image? background = null, bool stretch = false)

Parameters

settings SettingsBase

Settings for the game

name string

The name of the application for the title bar

icon Icon

The icon of the application for the title bar

background Image

A background image for the window while loading

stretch bool

Stretch background to fit the screen? (false will center it instead)

Properties

GuiManager

Manages all GUI dialogs displayed in the game

[LuaHide]
public GuiManager GuiManager { get; }

Property Value

GuiManager

Exceptions

InvalidOperationException

Run() has not been called yet.

Methods

ApplyGraphicsSettings()

Called when graphics settings from an external source need to be applied to the Engine

protected override void ApplyGraphicsSettings()

BuildEngineConfig(bool)

Called to generate an EngineConfig based on external settings

protected override EngineConfig BuildEngineConfig(bool fullscreen)

Parameters

fullscreen bool

Shall the configuration be generated for fullscreen mode?

Returns

EngineConfig

Debug()

Called when the debug form is to be displayed

[LuaHide]
public override void Debug()

Dispose(bool)

To be called by Dispose() and the object destructor.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true if called manually and not by the garbage collector.

GetElapsedGameTime(double)

Determines the amount of elapsed game time from the amount of elapsed real time.

protected virtual double GetElapsedGameTime(double elapsedTime)

Parameters

elapsedTime double

Returns

double

Initialize()

To be called after the window is ready and the Engine needs to be set up

protected override bool Initialize()

Returns

bool

true if the initialization worked, false if it failed and the app must be closed

LoadDialog(string)

Loads and displays a new dialog.

[LuaGlobal(Description = "Loads and displays a new dialog.")]
public DialogRenderer LoadDialog(string name)

Parameters

name string

The XML file to load from.

Returns

DialogRenderer

The newly created dialog.

LoadModalDialog(string)

Loads and displays a new modal (exclusively focused) dialog.

[LuaGlobal(Description = "Loads and displays a new modal (exclusively focused) dialog.")]
public DialogRenderer LoadModalDialog(string name)

Parameters

name string

The XML file to load from.

Returns

DialogRenderer

The newly created dialog.

LoadSplashDialog(string)

Loads a new exclusively displayed splash-screen dialog.

[LuaGlobal(Description = "Loads a new exclusive displayed splash-screen dialog.")]
public DialogRenderer LoadSplashDialog(string name)

Parameters

name string

The XML file to load from

Returns

DialogRenderer

The newly created dialog.

Remarks

Calling this method will close all other DialogRenderers.

NewLua()

Creates a new LuaInterface.Lua instance with commonly used objects preloaded.

[LuaHide]
public override Lua NewLua()

Returns

Lua

Render(double)

Called when the next frame needs to be rendered.

protected override void Render(double elapsedTime)

Parameters

elapsedTime double

The number of seconds that have passed since this method was last called.

ResetEngine()

Resets the Engine

protected override void ResetEngine()

Run()

Shows the window and runs the render loop until Exit() is called.

[LuaHide]
public override void Run()