Constructor
new Engine($parameters)
- Description:
- Creates a new game engine.
- Source:
Example
const engine = new Engine({$color, $container, $resolution});
engine.initiate(60);
await engine.preloadStage(SceneExample);
engine.createStage(SceneExample);
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
$parameters |
Object | The given parameters. | |
$parameters.$color |
Vector3 |
<optional> |
The rendering background color to use. |
$parameters.$container |
HTMLElement | The container for the game engine to create. | |
$parameters.$resolution |
Vector2 |
<optional> |
The rendering resolution to use. |
Members
container :HTMLElement
- Description:
- Gets the container.
- Source:
Gets the container.
Type:
- HTMLElement
stage :Stage
- Description:
- Gets the current stage.
- Source:
Gets the current stage.
Type:
uuid :string
- Description:
- Gets the uuid.
- Source:
Gets the uuid.
Type:
- string
Methods
createStage($stage)
- Description:
- Creates the given stage on the next tick update.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$stage |
Class.<Stage> | The stage to create on the next tick update. |
getInput($input) → {boolean}
- Description:
- Gets the current input state value of the given digital input.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$input |
string | The event code of the given digital input. |
Returns:
- Type
- boolean
getInputAnalog($input) → {number}
- Description:
- Gets the current input state value of the given analog input.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$input |
string | The event code of the given analog input. |
Returns:
- Type
- number
hasAssetLoaded($asset) → {boolean}
- Description:
- Checks if the engine has loaded the given asset.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$asset |
string | The asset source. |
Returns:
- Type
- boolean
initiate($tickrateMinimumopt)
- Description:
- Initiates the engine.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
$tickrateMinimum |
number |
<optional> |
60
|
The minimum acceptable number of ticks per virtual second (in ticks/s). |
preloadStage($stage) → {Promise.<Array.<(undefined|AudioBuffer|WebGLTexture)>>}
- Description:
- Preloads the assets of the given stage.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$stage |
Class.<Stage> | The stage to preload the assets from. |
Returns:
- Type
- Promise.<Array.<(undefined|AudioBuffer|WebGLTexture)>>
setColor($color)
- Description:
- Sets the rendering background color.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$color |
Vector3 | The rendering background color to set. |
setResolution($resolution)
- Description:
- Sets the rendering resolution.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$resolution |
Vector2 | The rendering resolution to set. |
terminate()
- Description:
- Terminates the engine (immediately) (must be used outside the lifecycle of this engine).
- Source:
tick($timetick)
- Description:
- Updates each system once.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
$timetick |
number | The tick duration (in ms). |