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
settingsSettingsBaseSettings for the game
namestringThe name of the application for the title bar
iconIconThe icon of the application for the title bar
backgroundImageA background image for the window while loading
stretchboolStretch
backgroundto fit the screen? (falsewill center it instead)
Properties
GuiManager
Manages all GUI dialogs displayed in the game
[LuaHide]
public GuiManager GuiManager { get; }
Property Value
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
fullscreenboolShall the configuration be generated for fullscreen mode?
Returns
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
disposingbooltrueif 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
elapsedTimedouble
Returns
Initialize()
To be called after the window is ready and the Engine needs to be set up
protected override bool Initialize()
Returns
- bool
trueif the initialization worked,falseif 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
namestringThe 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
namestringThe 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
namestringThe 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
elapsedTimedoubleThe 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()