Class Scene
Represents a game scene in the Genesis framework.
Assembly: Genesis.dll
Syntax
Constructors
Scene()
Creates a new game scene.
Declaration
Scene(string)
Creates a new game scene with the specified name.
Declaration
public Scene(string name)
Parameters
Type |
Name |
Description |
string |
name |
|
Properties
AfterCanvasRender
Event handler triggered after UI canvas rendering.
Declaration
public SceneEventHandler AfterCanvasRender { get; set; }
Property Value
AfterSceneRender
Event handler triggered after scene rendering.
Declaration
public SceneEventHandler AfterSceneRender { get; set; }
Property Value
BackgroundTexture
Set or gets the background texture for the scene
Declaration
public Texture BackgroundTexture { get; set; }
Property Value
BeforeCanvasPreperation
Event handler triggered before UI canvas preparation.
Declaration
public SceneEventHandler BeforeCanvasPreperation { get; set; }
Property Value
BeforeCanvasRender
Event handler triggered before UI canvas rendering.
Declaration
public SceneEventHandler BeforeCanvasRender { get; set; }
Property Value
BeforeScenePreperation
Event handler triggered before scene preparation.
Declaration
public SceneEventHandler BeforeScenePreperation { get; set; }
Property Value
BeforeSceneRender
Event handler triggered before scene rendering.
Declaration
public SceneEventHandler BeforeSceneRender { get; set; }
Property Value
Camera
Gets or sets the camera used for rendering the scene.
Declaration
public Camera Camera { get; set; }
Property Value
Canvas
Gets or sets the list of UI canvases within the scene.
Declaration
public List<Canvas> Canvas { get; set; }
Property Value
Layer
Gets or sets the list of layers within the scene.
Declaration
public List<Layer> Layer { get; set; }
Property Value
Name
Gets or sets the name of the scene.
Declaration
public string Name { get; set; }
Property Value
OnSceneResize
Event handler triggered when the scene is resized.
Declaration
public SceneSizeEvenHandler OnSceneResize { get; set; }
Property Value
PhysicHandler
Gets or sets the physics handler for the scene.
Declaration
public PhysicHandler PhysicHandler { get; set; }
Property Value
Methods
AddCanvas(Canvas)
Adds a new ui canvas to the scene
Declaration
public Canvas AddCanvas(Canvas canvas)
Parameters
Type |
Name |
Description |
Canvas |
canvas |
|
Returns
AddGameElement(string, GameElement)
Adds a GameElement in the scene. It will be placed in the given layer
Declaration
public void AddGameElement(string layerName, GameElement gameElement)
Parameters
AddGameElements(string, List<GameElement>)
Adds GameElements into the scene. The elements will be placed in the given layer
Declaration
public void AddGameElements(string layer, List<GameElement> gameElements)
Parameters
AddLayer(Layer)
Adds a layer to the scene
Declaration
public void AddLayer(Layer layer)
Parameters
Type |
Name |
Description |
Layer |
layer |
|
AddLayer(string)
Adds a layer to the scene
Declaration
public void AddLayer(string layerName)
Parameters
Type |
Name |
Description |
string |
layerName |
|
GetCanvas(string)
Gets the canvas with the given name
Declaration
public Canvas GetCanvas(string name)
Parameters
Type |
Name |
Description |
string |
name |
|
Returns
GetElement(string)
Gets the element with the given name. This function searchs
in every layer until it finds a element with an equal name.
Declaration
public GameElement GetElement(string name)
Parameters
Type |
Name |
Description |
string |
name |
|
Returns
GetElement(string, string)
Gets the element with the given name out of the given layer.
Declaration
public GameElement GetElement(string layerName, string name)
Parameters
Returns
GetElements(string)
Gets the elements from the given layer
Declaration
public List<GameElement> GetElements(string layername)
Parameters
Type |
Name |
Description |
string |
layername |
|
Returns
GetElements(string[])
Gets the elements from the given layers
Declaration
public List<GameElement> GetElements(string[] layer)
Parameters
Type |
Name |
Description |
string[] |
layer |
|
Returns
GetLayer(string)
Gets the layer with the given name
Declaration
public Layer GetLayer(string layername)
Parameters
Type |
Name |
Description |
string |
layername |
|
Returns
Gets a entity with the given name from the canvas
Declaration
public Widget GetWidget(string canvasName, string entityName)
Parameters
Returns
ImportScene2D(string, AssetManager)
Loads the given scene file into this scene
Declaration
public void ImportScene2D(string filename, AssetManager assetManager)
Parameters
Type |
Name |
Description |
string |
filename |
The file name
|
AssetManager |
assetManager |
The asset manager
|
Init(Game, IRenderDevice)
Declaration
public virtual void Init(Game game, IRenderDevice renderDevice)
Parameters
OnDestroy(Game)
Declaration
public virtual void OnDestroy(Game game)
Parameters
Type |
Name |
Description |
Game |
game |
|
OnRender(Game, IRenderDevice)
Declaration
public virtual void OnRender(Game game, IRenderDevice renderDevice)
Parameters
OnUpdate(Game, IRenderDevice)
Update the scene and the elements. Called every frame
Declaration
public virtual void OnUpdate(Game game, IRenderDevice renderDevice)
Parameters
RemoveCanvas(Canvas)
Removes the ui canvas from the scene
Declaration
public void RemoveCanvas(Canvas canvas)
Parameters
Type |
Name |
Description |
Canvas |
canvas |
|
RemoveCanvas(string)
Removes the ui canvas with the given name from the scene
Declaration
public void RemoveCanvas(string canvasName)
Parameters
Type |
Name |
Description |
string |
canvasName |
|
RemoveElement(GameElement)
Removes a element from the scene. This function will look in all
layer for the element.
Declaration
public void RemoveElement(GameElement element)
Parameters
RemoveElement(string, GameElement)
Removes a element from the given layer
Declaration
public void RemoveElement(string layerName, GameElement element)
Parameters
RemoveLayer(Layer)
Removes a layer from the scene
Declaration
public void RemoveLayer(Layer layer)
Parameters
Type |
Name |
Description |
Layer |
layer |
|
ResizeScene(Viewport)
Resizes the scene by invoking the event handler for scene resize.
Declaration
public virtual void ResizeScene(Viewport viewport)
Parameters
Type |
Name |
Description |
Viewport |
viewport |
The viewport containing information about the new dimensions.
|