Arcade
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
GameAPI.BudgetBoy.Stage Class Reference

Base class to inherit from when creating different levels or scenes for a game. Automatically updates and renders Entities that are added to it. More...

Inheritance diagram for GameAPI.BudgetBoy.Stage:
GameAPI.BudgetBoy.CoroutineContainer

Public Member Functions

 Stage ()
 Constructs a new Stage. More...
 
 Stage (Game game)
 Constructs a new Stage within a given Game. More...
 
float GetPanValue (Vector2F pos)
 Finds the stereo audio bias value for the given world position. More...
 
Add< T > (T item, int layer)
 Adds an IRenderable to the Stage at a certain layer. If the item added is also an IUpdatable, it will be added to the update queue. More...
 
Add< T > (T item)
 Adds an IUpdatable to the Stage at a certain layer. If the item added is also an IRenderable, you must use Add(item, layer) instead. More...
 
void SetLayer (IRenderable renderable, int layer)
 Sets the layer (rendering depth) of an IRenderable added to this Stage. More...
 
int GetLayer (IRenderable renderable)
 Returns the rendering layer (depth) of an IRenderable added to this Stage. More...
 
void Remove (Entity ent)
 Removes an Entity (an IRenderable, IUpdatable, or both) from this Stage. More...
 
void Remove (IRenderable item)
 Removes an IRenderable from this Stage. More...
 
void Remove (IUpdatable item)
 Removes an IUpdatable from this Stage. More...
 
Entity GetEntity (params Enum[] flags)
 Returns the first Entity added to this Stage that contains each of the specified flags. More...
 
TEntity GetEntity< TEntity > (params Enum[] flags)
 Returns the first Entity added to this Stage that is a given type and contains each of the specified flags. More...
 
IEnumerable< EntityGetEntities (params Enum[] flags)
 Returns all Entities added to this Stage that contain each of the specified flags. More...
 
IEnumerable< TEntity > GetEntities< TEntity > (params Enum[] flags)
 Returns all Entities added to this Stage that are a given type and contain each of the specified flags. More...
 
IEnumerable< EntityGetEntities (RectF bounds, params Enum[] flags)
 Returns all Entities added to this Stage that contain each of the specified flags and are within the specified area. More...
 
IEnumerable< TEntity > GetEntities< TEntity > (RectF bounds, params Enum[] flags)
 Returns all Entities added to this Stage that are a given type, contain each of the specified flags, and are within the specified area. More...
 
void Update ()
 Updates this stage, this already gets called every tick but it can be called again if needed. More...
 
void Render (Graphics graphics)
 Renders this stage, this already gets called every tick but it can be called again if needed. More...
 
void SaveState (BinaryWriter writer)
 
void LoadState (BinaryReader reader)
 
IEnumerator< EntityGetEnumerator ()
 

Protected Member Functions

virtual void OnInitialize ()
 Called once, before this Stage is entered for the first time. More...
 
virtual void OnEnter ()
 Called when the Game enters this Stage. Override this in game-specific Stages as needed. More...
 
virtual void OnLeave ()
 Called when the Game leaves this Stage. Override this in game-specific Stages as needed. More...
 
override Stage GetStage ()
 Should return the Stage containing this instance, used to find things like the time step to use for Delay awaitables. More...
 
virtual void OnUpdate ()
 Override this method for game-specific Stages (be sure to call base.OnUpdate()). More...
 
virtual void OnRender ()
 Override this method for game-specific Stages (be sure to call base.OnRender()). More...
 
virtual void OnSaveState (BinaryWriter writer)
 
virtual void OnLoadState (BinaryReader reader)
 
- Protected Member Functions inherited from GameAPI.BudgetBoy.CoroutineContainer
 CoroutineContainer ()
 Base constructor for a CoroutineContainer with an empty CoroutineCollection. More...
 
Awaitable Delay (double seconds)
 Creates a Delay Awaitable representing a pause of execution for the given duration. More...
 
Awaitable While (Func< bool > predicate)
 Creates a While Awaitable representing a pause of execution while the given predicate evaluates as true, where evaluation occurs each update. More...
 
Awaitable Until (Func< bool > predicate)
 Creates an Until Awaitable representing a pause of execution until the given predicate evaluates as true, where evaluation occurs each update. More...
 
Awaitable Sequential (params Awaitable[] inner)
 Creates a Sequential Awaitable representing a pause of execution until all elements of the given array of Awaitables have been executed in sequence. More...
 
Awaitable Parallel (params Awaitable[] inner)
 Creates a Parallel Awaitable representing a pause of execution until all elements of the given array of Awaitables have been executed concurrently. More...
 
Awaitable PlayAnimation (Animation anim)
 Creates a PlayAnimation Awaitable representing a pause of execution until the given Animation has completed. The animation will be advanced automatically. More...
 
Awaitable PlayAnimation (Animation anim, Awaitable @while)
 Creates a PlayAnimation Awaitable representing a pause of execution until either the given Animation or Awaitable has completed. The animation will be advanced automatically. Used for looping animations that would otherwise never terminate. More...
 
Awaitable WaitForAnimation (Animation anim)
 Creates a PlayAnimation Awaitable representing a pause of execution until the given Animation has completed. The animation will not be advanced automatically. More...
 
Awaitable WaitForAnimation (Animation anim, Awaitable @while)
 Creates a PlayAnimation Awaitable representing a pause of execution until either the given Animation or Awaitable has completed. The animation will not be advanced automatically. Used for looping animations that would otherwise never terminate. More...
 
Coroutine StartCoroutine (params Object[] awaitables)
 Starts a coroutine from a sequence of objects that can be converted to Awaitable instances. More...
 
Coroutine StartCoroutine (IEnumerator routine)
 Starts a coroutine from an IEnumerator that is expected to yeild Awaitable instances, null references (to delay until next the update), or other IEnumerator coroutines. When another IEnumerator is yielded the parent IEnumerator will pause execution until the child IEnumerator has finished. More...
 
Coroutine StartCoroutine (Func< IEnumerator > routine)
 Starts a coroutine from a function returning IEnumerator that is expected to yeild Awaitable instances, null references (to delay until next the update), or other IEnumerator coroutines. When another IEnumerator is yielded the parent IEnumerator will pause execution until the child IEnumerator has finished. More...
 
void UpdateCoroutines ()
 Causes all active Coroutine instances attached to this CoroutineContainer to execute one step. More...
 

Properties

virtual Game Game [get]
 Gets the Game this stage is part of. More...
 
Controls Controls [get]
 Gets the Controls used by the Game. More...
 
Graphics Graphics [get]
 Gets the current Game's Graphics context. More...
 
Audio Audio [get]
 Gets the current Game's Audio context. More...
 
Firmware Firmware [get]
 
TimeSpan TimeStep [get]
 Gets the Game's current timestep (time since last frame). More...
 

Detailed Description

Base class to inherit from when creating different levels or scenes for a game. Automatically updates and renders Entities that are added to it.

Constructor & Destructor Documentation

GameAPI.BudgetBoy.Stage.Stage ( )
inline

Constructs a new Stage.

GameAPI.BudgetBoy.Stage.Stage ( Game  game)
inline

Constructs a new Stage within a given Game.

Parameters
gameGame instance this Stage belongs to.

Member Function Documentation

T GameAPI.BudgetBoy.Stage.Add< T > ( item,
int  layer 
)
inline

Adds an IRenderable to the Stage at a certain layer. If the item added is also an IUpdatable, it will be added to the update queue.

Parameters
itemThe IRenderable to be added to this Stage.
layerThe rendering depth of the added IRenderable (higher layers are drawn above lower layers).
Type Constraints
T :IRenderable 
T GameAPI.BudgetBoy.Stage.Add< T > ( item)
inline

Adds an IUpdatable to the Stage at a certain layer. If the item added is also an IRenderable, you must use Add(item, layer) instead.

Parameters
itemThe IUpdatable to be added to this Stage.
Type Constraints
T :IUpdatable 
IEnumerable<Entity> GameAPI.BudgetBoy.Stage.GetEntities ( params Enum[]  flags)
inline

Returns all Entities added to this Stage that contain each of the specified flags.

Parameters
flagsOne or more enum flags.
IEnumerable<Entity> GameAPI.BudgetBoy.Stage.GetEntities ( RectF  bounds,
params Enum[]  flags 
)
inline

Returns all Entities added to this Stage that contain each of the specified flags and are within the specified area.

Parameters
boundsThe area to search within for Entities.
flagsOne or more enum flags.
IEnumerable<TEntity> GameAPI.BudgetBoy.Stage.GetEntities< TEntity > ( params Enum[]  flags)
inline

Returns all Entities added to this Stage that are a given type and contain each of the specified flags.

Parameters
flagsOne or more enum flags.
Type Constraints
TEntity :Entity 
IEnumerable<TEntity> GameAPI.BudgetBoy.Stage.GetEntities< TEntity > ( RectF  bounds,
params Enum[]  flags 
)
inline

Returns all Entities added to this Stage that are a given type, contain each of the specified flags, and are within the specified area.

Parameters
boundsThe area to search within for Entities.
flagsOne or more enum flags.
Type Constraints
TEntity :Entity 
Entity GameAPI.BudgetBoy.Stage.GetEntity ( params Enum[]  flags)
inline

Returns the first Entity added to this Stage that contains each of the specified flags.

Parameters
flagsOne or more enum flags.
TEntity GameAPI.BudgetBoy.Stage.GetEntity< TEntity > ( params Enum[]  flags)
inline

Returns the first Entity added to this Stage that is a given type and contains each of the specified flags.

Parameters
flagsOne or more enum flags.
Type Constraints
TEntity :Entity 
IEnumerator<Entity> GameAPI.BudgetBoy.Stage.GetEnumerator ( )
inline
int GameAPI.BudgetBoy.Stage.GetLayer ( IRenderable  renderable)
inline

Returns the rendering layer (depth) of an IRenderable added to this Stage.

Parameters
renderableThe IRenderable that is already added to this Stage.
float GameAPI.BudgetBoy.Stage.GetPanValue ( Vector2F  pos)
inline

Finds the stereo audio bias value for the given world position.

Parameters
posWorld position.
override Stage GameAPI.BudgetBoy.Stage.GetStage ( )
inlineprotectedvirtual

Should return the Stage containing this instance, used to find things like the time step to use for Delay awaitables.

Returns
The Stage containing this instance.

Implements GameAPI.BudgetBoy.CoroutineContainer.

void GameAPI.BudgetBoy.Stage.LoadState ( BinaryReader  reader)
inline
virtual void GameAPI.BudgetBoy.Stage.OnEnter ( )
inlineprotectedvirtual

Called when the Game enters this Stage. Override this in game-specific Stages as needed.

virtual void GameAPI.BudgetBoy.Stage.OnInitialize ( )
inlineprotectedvirtual

Called once, before this Stage is entered for the first time.

virtual void GameAPI.BudgetBoy.Stage.OnLeave ( )
inlineprotectedvirtual

Called when the Game leaves this Stage. Override this in game-specific Stages as needed.

virtual void GameAPI.BudgetBoy.Stage.OnLoadState ( BinaryReader  reader)
inlineprotectedvirtual
virtual void GameAPI.BudgetBoy.Stage.OnRender ( )
inlineprotectedvirtual

Override this method for game-specific Stages (be sure to call base.OnRender()).

virtual void GameAPI.BudgetBoy.Stage.OnSaveState ( BinaryWriter  writer)
inlineprotectedvirtual
virtual void GameAPI.BudgetBoy.Stage.OnUpdate ( )
inlineprotectedvirtual

Override this method for game-specific Stages (be sure to call base.OnUpdate()).

void GameAPI.BudgetBoy.Stage.Remove ( Entity  ent)
inline

Removes an Entity (an IRenderable, IUpdatable, or both) from this Stage.

Parameters
entThe Entity to be removed from this Stage.
void GameAPI.BudgetBoy.Stage.Remove ( IRenderable  item)
inline

Removes an IRenderable from this Stage.

Parameters
itemThe IRenderable to be removed from this Stage.
void GameAPI.BudgetBoy.Stage.Remove ( IUpdatable  item)
inline

Removes an IUpdatable from this Stage.

Parameters
itemThe IUpdatable to be removed from this Stage.
void GameAPI.BudgetBoy.Stage.Render ( Graphics  graphics)
inline

Renders this stage, this already gets called every tick but it can be called again if needed.

Parameters
graphicsThe Graphics context of the Game.
void GameAPI.BudgetBoy.Stage.SaveState ( BinaryWriter  writer)
inline
void GameAPI.BudgetBoy.Stage.SetLayer ( IRenderable  renderable,
int  layer 
)
inline

Sets the layer (rendering depth) of an IRenderable added to this Stage.

Parameters
renderableThe IRenderable that is already added to this Stage.
layerThe new depth of the IRenderable (higher layers are drawn above lower layers).
void GameAPI.BudgetBoy.Stage.Update ( )
inline

Updates this stage, this already gets called every tick but it can be called again if needed.

Property Documentation

Audio GameAPI.BudgetBoy.Stage.Audio
get

Gets the current Game's Audio context.

Controls GameAPI.BudgetBoy.Stage.Controls
get

Gets the Controls used by the Game.

Firmware GameAPI.BudgetBoy.Stage.Firmware
get
virtual Game GameAPI.BudgetBoy.Stage.Game
get

Gets the Game this stage is part of.

Graphics GameAPI.BudgetBoy.Stage.Graphics
get

Gets the current Game's Graphics context.

TimeSpan GameAPI.BudgetBoy.Stage.TimeStep
get

Gets the Game's current timestep (time since last frame).