MembersΒΆ

Properties

Name Type Description
Time long Time in seconds since canvas creation
DeltaTime long Time in seconds since previous frame
Width int Width of the canvas in pixels
Height int Height of the canvas in pixels
WindowTitle string Text displayed on the top window bar
Scale float Multiplier for all coordinates such as shape positions and scale
BackColor Color The color of the canvas background or back buffer
ExtraInfo bool Adds information such as FPS, render time, and shape count to the window title
VSync bool Limits the framerate to 60fps and waits for vertical screen synchronization (read only)
DebugMode bool Overlays text displaying render times and shape count of the canvas
Borderless bool wether the canvas window has Borders
AutoRender bool wether the canvas will render the adde shapes automatically
Center vec2 Property that returns the center point of the canvas
ShapeCount int Property that returns the number of shapes on the canvas at any given time
GameObjectCount int Property that returns the number of GameObjects the canvas
CameraPosition vec2 A translation applied to every coordinate on the screen before rendering
CameraZoom float A scale applied to every coordinate on the screen before rendering
Gravity vec2 Direction and amount of gravity for physics

Functions

Name Type Description
Add Shape Adds any shape or GameObject to the canvas and returns a copy of the reference
Remove void Removes a shape or Gameobject from the canvas given a reference
Refresh void Removes any lingering shapes from the canvas which have no references
SendBack void Sets a shape one index earlier in the drawing order
Sendforward void Sets a shape one index later in the drawing order
SendToBack void sets a shape to the first item in the drawing order
SentToFront void sets a shape to the last item in the drawing order
SwapDrawOrder void Switches the drawing order placement of two shapes on a canvas
setBBPixel void Sets the color of a single pixel in the background
setBBShape void Draws a shape to the background with no reoccurring performance cost and returns a reference
getPixel Color gets the color of a single pixel on the canvas
ClearBackBuffer void Redraws the background with the background color
Clear void Removes all shapes from the canvas
Close void Closes the canvas window or removes the canvas from a forms panel
Render void Renders the scene if AutoRender is turned off
SetWindowPostion void Moves the canvas window to a new location on the screen
AddRectangle Rectangle Adds a Rectangle to the canvas and returns a reference
AddCenteredectangle Rectangle Adds a centered Rectangle to the canvas and returns a reference
AddEllipse Ellipse Adds an Ellipse to the canvas and returns a reference
AddCenteredEllipse Ellipse Adds a centered Ellipse to the canvas and returns a reference
AddLine Line Adds a Line to the canvas where start and end points are defined and returns a reference
AddLine Line Adds a line segment to the canvas at a known start point using a length and rotation angle
AddSprite Sprite Adds an image to the canvas given a filepath and returns a reference
AddCenteredSprite Sprite Adds a centered image to the canvas given a filepath and returns a reference
AddText Text Adds text to the canvas given a bounding box and returns a reference
AddCenteredText Text Adds centered text to the canvas and returns a reference
AddCenteredPolygon Polygon Adds a centered polygon to the canvas and returns a reference
Instantiate GameObject Creates an initialized clone of a GameObject and adds it to the canvas with an optional transform
LoadAsset void Loads an image into the canvas memory. This prevents stuttering when loading sprites at runtime
LoadAssets void Loads multiple images into canvas memory with an optional loading screen
Invoke void Invokes a given function after a a number of seconds
InvokeRepeating void Invokes a function repeatedly at a given frequency
Dispose void Releases unmanaged canvas memory. Only used by the garbage collector and will cause problems if incorrectly called
RayCast bool detects the presence of a collider between two points

Events

Name Type Description
EarlyUpdate Action invoked once per frame
Update Action invoked once per frame, after EarlyUpdate
LateUpdate Action invoked once per frame, after LateUpdate
CanvasResized GLResizeEvent called when the canvas is manually resized or dy dragging the window