Class SceneManager
SceneManager extends MonoGame's Game class, adding tools for switching between scenes, each containing their own separate update and rendering logic.
Inheritance
Namespace: Ladybug.SceneManagement
Assembly: ladybug.dll
Syntax
public class SceneManager : Game
Constructors
SceneManager()
Declaration
public SceneManager()
Fields
graphics
The SceneManager's resident GraphicsDeviceManager, used by managed scenes for rendering.
Declaration
public GraphicsDeviceManager graphics
Field Value
| Type | Description |
|---|---|
| GraphicsDeviceManager |
SceneList
The list of Scenes being managed by this SceneManager
Declaration
protected List<Scene> SceneList
Field Value
| Type | Description |
|---|---|
| List<Scene> |
Remarks
Use LoadScene() and UnloadScene() to add and remove Scenes from the list
Methods
Draw(GameTime)
Renders all Scenes managed by this SceneManager which are not Suspended.
Declaration
protected override void Draw(GameTime gameTime)
Parameters
| Type | Name | Description |
|---|---|---|
| GameTime | gameTime |
Initialize()
Declaration
protected override void Initialize()
LoadContent()
Declaration
protected override void LoadContent()
LoadScene(Scene)
Loads a scene into the SceneManager, which will update the Scene every game loop.
Declaration
public virtual void LoadScene(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene |
LoadSceneAsync(Scene)
Loads a Scene asynchronously, calling its LoadContentAsync and InitializeAsync before adding the scene to the SceneManager via LoadScene
Declaration
public virtual void LoadSceneAsync(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene |
Remarks
Calls LoadScene, meaning the scene's LoadContent and LoadScene methods are called after their async counterparts.
PauseScene(Scene)
Declaration
public virtual void PauseScene(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene |
SuspendScene(Scene)
Suspends a scene, causing both its Update() and Draw() to be skipped
Declaration
public virtual void SuspendScene(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene |
UnloadScene(Scene)
Removes a scene from the SceneManager, unloading its assets and removing it from the scene execution loop.
Declaration
public virtual void UnloadScene(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene |
UnpauseScene(Scene)
Unpauses a Scene, causing it to resume its Update()
Declaration
public virtual void UnpauseScene(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene |
UnsuspendScene(Scene)
Unsuspends a scene, resuming both its Update() and Draw().
Declaration
public virtual void UnsuspendScene(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene |
Update(GameTime)
Updates all Scenes managed by this SceneManager which are neither Paused nor Suspended.
Declaration
protected override void Update(GameTime gameTime)
Parameters
| Type | Name | Description |
|---|---|---|
| GameTime | gameTime |