OmegaEngine API  1.0.3
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
OmegaEngine.GameBase Class Reference

Automatically provides an Engine instance with a fullscreen-capable window, render loop, input handling, etc. More...

Inheritance diagram for OmegaEngine.GameBase:

Classes

class  GameForm
 An internal Windows Form to use as Engine render target with mouse+keyboard event handling More...
 

Public Member Functions

virtual void Run ()
 Shows the window and runs the render loop until Exit is called. More...
 
void Exit ()
 Stops the render loop and closes the window More...
 
void AddInputReceiver (IInputReceiver receiver)
 Calls InputProvider.AddReceiver for all default InputProviders. More...
 
void RemoveInputReceiver (IInputReceiver receiver)
 Calls InputProvider.RemoveReceiver for all default InputProviders. More...
 
virtual void Debug ()
 Called when the debug form is to be displayed More...
 
virtual Lua NewLua ()
 Creates a new Lua instance with commonly used objects preloaded. More...
 
void Dispose ()
 Dispose the Engine, the internal windows form, etc. More...
 

Static Public Member Functions

static void Crash ()
 Crashes the game for testing purposes More...
 

Protected Member Functions

 GameBase (string name, Icon icon=null, Image background=null, bool stretch=false)
 Sets up the Form. Call ToWindowed or ToFullscreen and Run afterwards. More...
 
void ToFullscreen ()
 Sets up the System.Windows.Forms.Form for fullscreen display More...
 
void ToWindowed (Size size)
 Sets up the System.Windows.Forms.Form for normal windowed (non-fullscreen) mode More...
 
void UpdateStatus (string message)
 Updates the current status of the loading process More...
 
virtual void Dispose (bool disposing)
 To be called by IDisposable.Dispose and the object destructor. More...
 
virtual void ResetEngine ()
 Resets the Engine More...
 
virtual EngineConfig BuildEngineConfig (bool fullscreen)
 Called to generate an EngineConfig based on external settings More...
 
virtual void ApplyGraphicsSettings ()
 Called when graphics settings from an external source need to be applied to the Engine More...
 
virtual bool Initialize ()
 To be called after the window is ready and the Engine needs to be set up More...
 
virtual void Render (double elapsedTime)
 Called when the next frame needs to be rendered. More...
 

Protected Attributes

readonly GameForm Form
 The internal form used as the Engine render-targets More...
 

Properties

bool Disposed [get, set]
 Has the game been shutdown? More...
 
Engine Engine [get, set]
 The Engine instance used by the game. Warning! Only set after Control.Show has been called More...
 
bool Fullscreen [get, set]
 Is the game in fullscreen mode? More...
 
bool Loading [get, set]
 Indicates the game is currently loading something and the user must wait. More...
 
KeyboardInputProvider KeyboardInputProvider [get]
 A default Input.KeyboardInputProvider hooked up to the Form. More...
 
MouseInputProvider MouseInputProvider [get]
 A default Input.MouseInputProvider hooked up to the Form. More...
 
TouchInputProvider TouchInputProvider [get]
 A default Input.TouchInputProvider hooked up to the Form. More...
 

Detailed Description

Automatically provides an Engine instance with a fullscreen-capable window, render loop, input handling, etc.

By using this class, you don't need to create a window, set up InputProviders, provide access to DebugConsole, etc. yourself.

You should override at least Initialize and Render. This corresponds to the template method pattern.

Constructor & Destructor Documentation

OmegaEngine.GameBase.GameBase ( string  name,
Icon  icon = null,
Image  background = null,
bool  stretch = false 
)
inlineprotected

Sets up the Form. Call ToWindowed or ToFullscreen and Run afterwards.

Parameters
nameThe name of the application for the title bar
iconThe icon of the application for the title bar
backgroundA background image for the window while loading
stretchStretch background to fit the screen? (false will center it instead)

Member Function Documentation

void OmegaEngine.GameBase.AddInputReceiver ( IInputReceiver  receiver)
inline

Calls InputProvider.AddReceiver for all default InputProviders.

Parameters
receiverThe object to receive the commands.
virtual void OmegaEngine.GameBase.ApplyGraphicsSettings ( )
inlineprotectedvirtual

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

virtual EngineConfig OmegaEngine.GameBase.BuildEngineConfig ( bool  fullscreen)
inlineprotectedvirtual

Called to generate an EngineConfig based on external settings

Parameters
fullscreenShall the configuration be generated for fullscreen mode?
static void OmegaEngine.GameBase.Crash ( )
inlinestatic

Crashes the game for testing purposes

virtual void OmegaEngine.GameBase.Debug ( )
inlinevirtual

Called when the debug form is to be displayed

void OmegaEngine.GameBase.Dispose ( )
inline

Dispose the Engine, the internal windows form, etc.

virtual void OmegaEngine.GameBase.Dispose ( bool  disposing)
inlineprotectedvirtual

To be called by IDisposable.Dispose and the object destructor.

Parameters
disposingtrue if called manually and not by the garbage collector.
void OmegaEngine.GameBase.Exit ( )
inline

Stops the render loop and closes the window

virtual bool OmegaEngine.GameBase.Initialize ( )
inlineprotectedvirtual

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

Returns
true if the initialization worked, false if it failed an the app must be closed
virtual Lua OmegaEngine.GameBase.NewLua ( )
inlinevirtual

Creates a new Lua instance with commonly used objects preloaded.

void OmegaEngine.GameBase.RemoveInputReceiver ( IInputReceiver  receiver)
inline

Calls InputProvider.RemoveReceiver for all default InputProviders.

Parameters
receiverThe object to no longer receive the commands.
virtual void OmegaEngine.GameBase.Render ( double  elapsedTime)
inlineprotectedvirtual

Called when the next frame needs to be rendered.

Parameters
elapsedTimeThe number of seconds that have passed since this method was last called.
virtual void OmegaEngine.GameBase.ResetEngine ( )
inlineprotectedvirtual

Resets the Engine

virtual void OmegaEngine.GameBase.Run ( )
inlinevirtual

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

void OmegaEngine.GameBase.ToFullscreen ( )
inlineprotected

Sets up the System.Windows.Forms.Form for fullscreen display

void OmegaEngine.GameBase.ToWindowed ( Size  size)
inlineprotected

Sets up the System.Windows.Forms.Form for normal windowed (non-fullscreen) mode

Parameters
sizeThe window size
void OmegaEngine.GameBase.UpdateStatus ( string  message)
inlineprotected

Updates the current status of the loading process

Parameters
messageThe new message to display

Member Data Documentation

readonly GameForm OmegaEngine.GameBase.Form
protected

The internal form used as the Engine render-targets

Property Documentation

bool OmegaEngine.GameBase.Disposed
getset

Has the game been shutdown?

Engine OmegaEngine.GameBase.Engine
getset

The Engine instance used by the game. Warning! Only set after Control.Show has been called

bool OmegaEngine.GameBase.Fullscreen
getset

Is the game in fullscreen mode?

KeyboardInputProvider OmegaEngine.GameBase.KeyboardInputProvider
get

A default Input.KeyboardInputProvider hooked up to the Form.

bool OmegaEngine.GameBase.Loading
getset

Indicates the game is currently loading something and the user must wait.

On Windows 7 and newer this will cause a neat taskbar animation.

MouseInputProvider OmegaEngine.GameBase.MouseInputProvider
get

A default Input.MouseInputProvider hooked up to the Form.

TouchInputProvider OmegaEngine.GameBase.TouchInputProvider
get

A default Input.TouchInputProvider hooked up to the Form.


The documentation for this class was generated from the following files: