diff --git a/package-lock.json b/package-lock.json index 3c27fb2..d491cea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -523,14 +523,14 @@ } }, "node_modules/@litecanvas/litecanvas": { - "version": "0.26.0", - "resolved": "https://registry.npmjs.org/@litecanvas/litecanvas/-/litecanvas-0.26.0.tgz", - "integrity": "sha512-2PmcaMJG0x4pTi02Uo6K/7iKt8K911Rcs5Ouz/kAMtzgQT+juD0WZOmjvqF0PQAEsAsUAM3frips7d+wZV5Uqw==" + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@litecanvas/litecanvas/-/litecanvas-0.27.0.tgz", + "integrity": "sha512-Nlf4UhX3yOu1+ZRa1Jj5OXHWx2LQk91dbA8QOh0DE9N9jalY4wb3AMojTW3O1wgYhvrVcC4x3HivZAgj9zSVRg==" }, "node_modules/@litecanvas/plugin-asset-loader": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@litecanvas/plugin-asset-loader/-/plugin-asset-loader-0.3.1.tgz", - "integrity": "sha512-M+VMSSt8Dw0/+5BH3vms2ra5gFXvYnltpqs2CnLjltGZu2+woa3zx5ClPbKynvZeXKqq1pv522BA+PIekJDPwQ==" + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@litecanvas/plugin-asset-loader/-/plugin-asset-loader-0.4.0.tgz", + "integrity": "sha512-ebqPKSQG3MUzMd+62vlVZmaxQodg6v8nW6L/Gfa/4B6bJgDRv/AQntwULi1NIka3xb639HKRco2OHSBevZ+8SQ==" }, "node_modules/codemirror": { "version": "6.0.1", diff --git a/public/about.html b/public/about.html index 9efda72..6cd7d61 100644 --- a/public/about.html +++ b/public/about.html @@ -93,6 +93,7 @@

LITECANVAS

Configuration | Drawing | Sound | Math | Globals | + Plugin API | Advanced @@ -346,13 +347,17 @@

Math

chance(p: number): boolean // Choose a random item from a Array -choose(arr: Array): any +choose(arr: Array): T // Calculates a linear (interpolation) value over `t`. // example: lerp(0, 50, 0.5) returns 25 // learn more: https://gamedev.net/tutorials/programming/general-and-gameplay-programming/a-brief-introduction-to-lerp-r4954/ lerp(a: number, b: number, t: number): number +// Interpolate between 2 values. +// Optionally, takes a custom periodic function (default = `Math.sin`). +wave(lower, higher, t, fn = Math.sin): number + // Convert degrees to radians deg2rad(n: number): number @@ -445,7 +450,7 @@

Math

// all arguments are required and must be numbers colcirc(x1, y1, r1, x2, y2, r2): boolean -

Globals Variables

+

Variables

// the game canvas
 CANVAS: HTMLCanvasElement
@@ -465,6 +470,9 @@ 

Globals Variables

// the FPS meter FPS: number +// the fixed delta time +DT: number + // the amount of time since the game started ELAPSED: number @@ -487,6 +495,21 @@

Globals Variables

HALF_PI: number // approximately 1.57079 radians (90ยบ)
+

Plugin API

+ +
// create or update variables
+setvar(name: string, value: any): void
+
+// get the color value
+getcolor(index: number): string
+
+// add a game loop listener
+// returns a function that removes the listener
+listen(event: string, callback: function, highPriority = false): function
+
+// call all listeners of a specific game loop event
+emit(event, ...args): void
+

Advanced Features

// the plugin "Asset Loader" is automatically loaded into the playground
diff --git a/public/app.js b/public/app.js
index 72dbdf8..ac15221 100644
--- a/public/app.js
+++ b/public/app.js
@@ -238,7 +238,7 @@ function draw () {
     <\/script>