engine2d manages all of the graphics rendered in 2D. It uses Babylonjs 4.1 for rendering. engine2d uses Babylonjs as a base and builds off of it to automatically interact with the rest of the engine, as well as adding custom functions for added features and ease of use for the already existing ones.
A procedurally generated engine3d box
A procedurally generated engine3d sphere
A procedurally generated engine3d plane
A procedurally generated engine3d plane
engine3d point light source
load assets into engine3d cache
add engine3d entities
get engine2d entites
get statistics on the performance
update function
render function
control the ambient light of a scene
creates a new engine 2d canvas
Parameter | Type | Description |
---|---|---|
name | String | unique name of the canvas |
config | Object | options to configure the canvas |
Properties to configure the canvas. All properties are optional.
Parameter | Type | Description | Default |
---|---|---|---|
resolution | Int | height resolution of the canvas | actual client screen resolution |
defaultResolution | Int | sets the resolution for auto scaling. Common practise is to use the screen resolution used in development | actual client screen resolution |
antialias | Boolean | whether to use antialiasing | true |
shadowResolution | Int | resolution of the shadow map | 4096 |
poll | Int | Polling rate of the update function. The update function will run this many times per second | 64 |
vsync | Boolean | use vsync or not | true |
fpsBuffer | Int | sets the maximum samples used to calculate average FPS | 1000 |
preload | Function | function to run when loading assets. Assets can be loaded and unloaded later if you want, but main assets should be loaded here. | |
create | Function | function to run while creating the scene | |
update | Function | update function which runs at a constant polling rate set by the poll property | |
render | Function | render function which runs as fast as possible and is tied to framerate |
get / set the zIndex of a canvas
Parameter | Type | Description |
---|---|---|
canvas | String | name of the canvas |
zIndex | Int | (Optional) the value to set the z index |
interact with the Babylonjs render engine directly