Class Scene
A Scene represents a single game Update/Render loop.
Inherited Members
Namespace: Ladybug
Assembly: ladybug.dll
Syntax
public abstract class Scene
Constructors
| Improve this Doc View SourceScene()
Creates a new Scene
Declaration
public Scene()
Scene(Game)
Creates a new Scene
Declaration
public Scene(Game game)
Parameters
Type | Name | Description |
---|---|---|
Game | game | Game instance that will be managing this Scene |
Properties
| Improve this Doc View SourceContent
Reference to the Scene's ContentManager
Declaration
public ContentManager Content { get; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Content.ContentManager |
Remarks
This ContentManager is intended to be accessed primarily through the Scene's ResourceCatalog.
ContentLoaded
Whether this Scene has completed content loading
Declaration
public bool ContentLoaded { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ContentLoadedAsync
Whether this Scene has completed asynchronous content loading
Declaration
public bool ContentLoadedAsync { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Game
Reference to the Game instance that is handling this scene
Declaration
public Game Game { get; protected set; }
Property Value
Type | Description |
---|---|
Game |
Initialized
Whether this Scene has completed initialization
Declaration
public bool Initialized { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
InitializedAsync
Whether this Scene has completed asynchronous initialization
Declaration
public bool InitializedAsync { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ResourceCatalog
This Scene's resident ResourceCatalog
Declaration
public ResourceCatalog ResourceCatalog { get; protected set; }
Property Value
Type | Description |
---|---|
ResourceCatalog |
Services
Contains services registered with this Scene
Declaration
public GameServiceContainer Services { get; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.GameServiceContainer |
SpriteBatch
The Scene's default SpriteBatch
Declaration
public SpriteBatch SpriteBatch { get; }
Property Value
Type | Description |
---|---|
Microsoft.Xna.Framework.Graphics.SpriteBatch |
State
Current SceneState of the Scene
Declaration
public SceneState State { get; }
Property Value
Type | Description |
---|---|
SceneState |
Methods
| Improve this Doc View SourceCompose()
Begins inline composition of a new Scene
Declaration
public static ComposedScene Compose()
Returns
Type | Description |
---|---|
ComposedScene |
Compose(Game)
Begins inline composition of a new Scene
Declaration
public static ComposedScene Compose(Game game)
Parameters
Type | Name | Description |
---|---|---|
Game | game |
Returns
Type | Description |
---|---|
ComposedScene |
Draw(GameTime)
Run when the Scene is drawn
Declaration
protected virtual void Draw(GameTime gameTime)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.GameTime | gameTime |
Initialize()
Run when the Scene is Initialized
Declaration
protected virtual void Initialize()
InitializeAsync()
Run when the Scene is initialized asynchronously
Declaration
protected virtual void InitializeAsync()
LoadContent()
Run when content is loaded into the Scene
Declaration
protected virtual void LoadContent()
LoadContentAsync()
Run when content is loaded asynchronously
Declaration
protected virtual void LoadContentAsync()
Pause()
Run when the Scene is paused
Declaration
protected virtual void Pause()
Remarks
To pause the scene, use PauseScene() instead
PauseScene()
Pauses the Scene
Declaration
public void PauseScene()
Remarks
A paused Scene will not execute Update actions, but will still execute Draw actions
Resume()
Run when the scene is unpaused or unsuspended
Declaration
protected virtual void Resume()
Remarks
To resum the scene, use UnpauseScene() or UnsuspendScene() instead
SetGame(Game)
Sets the Game object that will be managing this Scene
Declaration
public void SetGame(Game game)
Parameters
Type | Name | Description |
---|---|---|
Game | game | Game object that will be managing this Scene |
SetInputAction(String, Action<InputActionEventArgs>)
Sets the action to be performed upon a specific input action
Declaration
protected void SetInputAction(string name, Action<InputActionEventArgs> action)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
System.Action<InputActionEventArgs> | action |
Stop()
Run when the scene is paused or suspended
Declaration
protected virtual void Stop()
Remarks
To stop the scene, use PauseScene() or SuspendScene() instead
Suspend()
Run when the scene is suspended
Declaration
protected virtual void Suspend()
Remarks
To suspend the scene, use SuspendScene() instead
SuspendScene()
Suspends the Scene
Declaration
public void SuspendScene()
Remarks
A suspended Scene will not execute Update or Draw actions
Unload()
Run when the Scene is unloaded
Declaration
protected virtual void Unload()
Remarks
To unload the scene, use UnloadScene() instead
UnloadScene()
Unloads the Scene, removing it from the Game instance that is managing it
Declaration
public void UnloadScene()
Unpause()
Run when the Scene is unpaused
Declaration
protected virtual void Unpause()
Remarks
To unpause the scene, use UnpauseScene() instead
UnpauseScene()
Unpauses the Scene
Declaration
public void UnpauseScene()
Remarks
Returns the Scene to ACTIVE state, only if state was previously PAUSED
Unsuspend()
Run when the scene is unsuspended
Declaration
protected virtual void Unsuspend()
Remarks
To unsuspend the scene, use UnsuspendScene() instead
UnsuspendScene()
Unsuspends the Scene
Declaration
public void UnsuspendScene()
Remarks
Returns the Scene to ACTIVE state, only if state was previously SUSPENDED
Update(GameTime)
Run each frame when the Scene is updated
Declaration
protected virtual void Update(GameTime gameTime)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.GameTime | gameTime |
Events
| Improve this Doc View SourceInitializeAsyncComplete
Asynchronous initialization has completed
Declaration
public event EventHandler InitializeAsyncComplete
Event Type
Type | Description |
---|---|
System.EventHandler |
InitializeAsyncStart
Asynchronous initialization has started
Declaration
public event EventHandler InitializeAsyncStart
Event Type
Type | Description |
---|---|
System.EventHandler |
InitializeComplete
Initialization has completed
Declaration
public event EventHandler InitializeComplete
Event Type
Type | Description |
---|---|
System.EventHandler |
LoadContentAsyncComplete
Asynchronous content loading has completed
Declaration
public event EventHandler LoadContentAsyncComplete
Event Type
Type | Description |
---|---|
System.EventHandler |
LoadContentAsyncStart
Asynchronous content loading has started
Declaration
public event EventHandler LoadContentAsyncStart
Event Type
Type | Description |
---|---|
System.EventHandler |
LoadContentComplete
Content loading has completed
Declaration
public event EventHandler LoadContentComplete
Event Type
Type | Description |
---|---|
System.EventHandler |
Paused
Scene has been paused
Declaration
public event EventHandler Paused
Event Type
Type | Description |
---|---|
System.EventHandler |
Resumed
The Scene has been unpaused or unsuspended
Declaration
public event EventHandler Resumed
Event Type
Type | Description |
---|---|
System.EventHandler |
Stopped
The Scene has been paused or suspended
Declaration
public event EventHandler Stopped
Event Type
Type | Description |
---|---|
System.EventHandler |
Suspended
Scene has been suspended
Declaration
public event EventHandler Suspended
Event Type
Type | Description |
---|---|
System.EventHandler |
Unloaded
Scene has been unloaded
Declaration
public event EventHandler Unloaded
Event Type
Type | Description |
---|---|
System.EventHandler |
Unpaused
Scene has been unpaused
Declaration
public event EventHandler Unpaused
Event Type
Type | Description |
---|---|
System.EventHandler |
Unsuspended
Scene has been unsuspended
Declaration
public event EventHandler Unsuspended
Event Type
Type | Description |
---|---|
System.EventHandler |