Show / Hide Table of Contents

Class RenderCanvas

A render canvas object references the physical output screen space real estate (e.g. the rendering window). A typical Game application will inherit from this class and overwrite methods to implement your user code to to be performed on events like initialization, resize, and display refresh. In the future, it will be likely that this class' functionality will be divided at two different places with one containing the more view oriented aspects and the other containing the more application oriented aspects.

Inheritance
System.Object
RenderCanvas
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Fusee.Engine.Core
Assembly: Fusee.Engine.Core.dll
Syntax
public class RenderCanvas

Fields

LoadingCompleted

This event is usually triggered when loading is completed (after init() method)

Declaration
public EventHandler<EventArgs> LoadingCompleted
Field Value
Type Description
System.EventHandler<System.EventArgs>

Properties

CanvasImplementor

Gets and sets the canvas implementor.

Declaration
public IRenderCanvasImp CanvasImplementor { get; set; }
Property Value
Type Description
IRenderCanvasImp

The canvas implementor.

ContextImplementor

Gets and sets the RenderContext implementor.

Declaration
public IRenderContextImp ContextImplementor { get; set; }
Property Value
Type Description
IRenderContextImp

The context implementor.

Fullscreen

Gets and sets a value indicating whether this RenderCanvas is fullscreen.

Declaration
public bool Fullscreen { get; set; }
Property Value
Type Description
System.Boolean

true if fullscreen; otherwise, false.

Height

Retrieves the height of the canvas.

Declaration
public int Height { get; }
Property Value
Type Description
System.Int32

The height in pixels.

InputDriverImplementor

Gets and sets the input driver implementor.

Declaration
public IInputDriverImp InputDriverImplementor { get; set; }
Property Value
Type Description
IInputDriverImp

The input driver implementor.

IsLoaded

true when InitAsync() finished Prevents RenderAFrame() and Update() while false

Declaration
public bool IsLoaded { get; set; }
Property Value
Type Description
System.Boolean

IsShuttingDown

Used to stop the rendering process when the application is shutting down. Needed when the creation and running of an application are executed in different threads. Will invoke ApplicationIsShuttingDown.

Declaration
public bool IsShuttingDown { get; }
Property Value
Type Description
System.Boolean

RC

Returns the render context object.

Declaration
public RenderContext RC { get; }
Property Value
Type Description
RenderContext

Use the render context (RenderContext) to fill the render canvas with 3d contents.

VideoManagerImplementor

Gets and sets the video manager implementor.

Declaration
public IVideoManagerImp VideoManagerImplementor { get; set; }
Property Value
Type Description
IVideoManagerImp

The video manager implementor.

VSync

Gets and sets a value indicating whether VSync is active.

Declaration
public bool VSync { get; set; }
Property Value
Type Description
System.Boolean

true if VSync is active; otherwise, false.

Width

Retrieves the width of the canvas.

Declaration
public int Width { get; }
Property Value
Type Description
System.Int32

The width in pixels.

Methods

CloseGameWindow()

Closes the GameWindow with a call to OpenTK.

Declaration
public void CloseGameWindow()

DeInit()

Used to release the resources of all audio and network instances. All audio and network resources get reset.

Declaration
public virtual void DeInit()

GetAppName()

Gets the name of the app.

Declaration
protected string GetAppName()
Returns
Type Description
System.String

Name of the app as string.

GetWindowHeight()

Gets the height of the application's window.

Declaration
protected int GetWindowHeight()
Returns
Type Description
System.Int32

Height of the application's window as int.

GetWindowWidth()

Gets the width of the application's window.

Declaration
protected int GetWindowWidth()
Returns
Type Description
System.Int32

Width of the application's window as int.

Init()

Callback method to invoke user code after initialization of the render canvas.

Declaration
public virtual void Init()
Remarks

Override this method in inherited classes of RenderCanvas to apply initialization code. Typically, an application will call one-time initialization code on the render context (RC) to set render states.

InitApp()

Initializes the application and prepares it for the rendering loop.

Declaration
public void InitApp()

InitAsync()

Called after Init() can be used to await async tasks (e.g. loading methods)

Declaration
public virtual async Task InitAsync()
Returns
Type Description
System.Threading.Tasks.Task

OpenLink(String)

Opens the given URL in the user's standard web browser. The link MUST start with "http://".

Declaration
public void OpenLink(string link)
Parameters
Type Name Description
System.String link

The URL to open

Present()

Presents the contents of the back-buffer on the visible part of this render canvas.

Declaration
public void Present()
Remarks

Call this method from your rendering code implementation RenderAFrame() after rendering geometry on the rendering context.

RenderAFrame()

Callback method to invoke user code for rendering a frame.

Declaration
public virtual void RenderAFrame()
Remarks

Override this method in inherited classes of RenderCanvas to render 3D contents. Typically, an application will use the render context (RC) to achieve this. This loop will only run while the application is visible.

Resize(ResizeEventArgs)

Callback method to invoke user code when the render canvas size changes.

Declaration
public virtual void Resize(ResizeEventArgs e)
Parameters
Type Name Description
ResizeEventArgs e
Remarks

Override this method in inherited classes of RenderCanvas to apply window resize code. Typically, an application will change the projection matrix of the render context (RC) to match the new aspect ratio.

Run()

Runs this instance.

Declaration
public void Run()
Remarks

Users should call this method of their RenderCanvas instance to start the application. The RenderCanvas will then do all necessary initialization, call the Init method and enter the application main loop.

SetCursor(CursorType)

Set the cursor (the mouse pointer image) to one of the predefined types

Declaration
public void SetCursor(CursorType cursorType)
Parameters
Type Name Description
CursorType cursorType

The type of the cursor to set.

SetWindowSize(Int32, Int32, Int32, Int32, Boolean)

Sets the size of the output window for desktop development.

Declaration
public void SetWindowSize(int width, int height, int posx = -1, int posy = -1, bool borderHidden = false)
Parameters
Type Name Description
System.Int32 width

The width of the window.

System.Int32 height

The height of the window.

System.Int32 posx

The x position of the window.

System.Int32 posy

The y position of the window.

System.Boolean borderHidden

Show the window border or not.

Update()

Callback method to invoke user code for updating a frame.

Declaration
public virtual void Update()
Remarks

Override this method in inherited classes of RenderCanvas to update your scene. Consider the code you implement here as the body of the application's loop.

Events

ApplicationIsShuttingDown

Used to inject functionality that is meant to be executed when the application is shutting down.

Declaration
public event EventHandler ApplicationIsShuttingDown
Event Type
Type Description
System.EventHandler

EndOfFrame

Used to inject functionality that is meant to execute at the end of each frame. E.g. if components of the SceneGraph need to be changed.

Declaration
public event EventHandler EndOfFrame
Event Type
Type Description
System.EventHandler
Generated by DocFX
GitHub Repo
Back to top