Skip to content

Commit 031e560

Browse files
committed
update engine
also: - add plugin-migrate - update plugin-asset-loader - update docs and completions - update demo
1 parent 1376343 commit 031e560

File tree

9 files changed

+720
-530
lines changed

9 files changed

+720
-530
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
"esbuild": "^0.25.5"
2121
},
2222
"dependencies": {
23-
"@babel/standalone": "^7.27.5",
23+
"@babel/standalone": "^7.27.6",
2424
"@codemirror/lang-javascript": "^6.2.4",
2525
"@codemirror/theme-one-dark": "^6.1.2",
2626
"@litecanvas/plugin-asset-loader": "latest",
27+
"@litecanvas/plugin-migrate": "latest",
2728
"@litecanvas/utils": "latest",
2829
"codemirror": "^6.0.1",
2930
"eslint-linter-browserify": "9.21.0",

public/about.html

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -370,34 +370,28 @@ <h2><a id="globals">Global Variables</a></h2>
370370
<pre><code class="language-typescript">// the game canvas
371371
CANVAS: HTMLCanvasElement
372372

373+
// the amount of time since the game started
374+
T: number
375+
373376
// the game screen width
374-
WIDTH: number
377+
W: number
375378

376379
// the game screen height
377-
HEIGHT: number
380+
H: number
378381

379382
// the center X of game screen
380-
CENTERX: number
383+
CX: number
381384

382385
// the center Y of game screen
383-
CENTERY: number
384-
385-
// the amount of time since the game started
386-
ELAPSED: number
386+
CY: number
387387

388388
// the current mouse's X-position
389389
// or -1 (if the mouse was not used or detected)
390-
MOUSEX: number
390+
MX: number
391391

392392
// the current mouse's Y-position
393393
// or -1 (if the mouse was not used or detected)
394-
MOUSEY: number
395-
396-
// the default sound played in `sfx()`
397-
DEFAULT_SFX: number[]
398-
399-
// the list of colors in the current palette
400-
COLORS: string[]
394+
MY: number
401395

402396
// Math constants
403397
PI: number // approximately 3.14 radians (180°)
@@ -585,6 +579,10 @@ <h2><a id="math">Functions for Math</a></h2>
585579
// example: norm(50, 0, 100) returns 0.5
586580
norm(value, min, max): number
587581

582+
// Interpolate between 2 values using a periodic function (by default is Math.sin).
583+
// example: wave(-100, 100, T)
584+
wave(from: number, to: number, t: number, fn = Math.sin): number
585+
588586
// Returns the sine of a number in radians.
589587
sin(angle: number): number
590588

@@ -654,10 +652,10 @@ <h2><a id="math">Functions for Math</a></h2>
654652
// and max (inclusive)
655653
randi(min = 0, max = 1): number
656654

657-
// If a value is passed, initializes the random number generator (RNG)
658-
// with an explicit seed value (a number >= 0). Otherwise, returns the current seed state.
655+
// initializes the random number generator (RNG) with an explicit seed value
659656
// By default, the initial seed is the current timestamp (from `Date.now()`).
660-
seed(value: number | null): number</code></pre>
657+
// Note: The value should be a integer number greater than or equal to zero.
658+
rseed(value: number): void</code></pre>
661659

662660
<h2><a id="engine-api">Engine API</a></h2>
663661

@@ -681,26 +679,38 @@ <h2><a id="engine-api">Engine API</a></h2>
681679
// A value of 0 freezes time (equivalent to pausing).
682680
timescale(value: number): void
683681

684-
// Sets the target FPS (frames per second or frame rate)
685-
setfps(value: number): void
682+
// Sets the target FPS (frames per second)
683+
framerate(value: number): void
686684

687685
// the following functions are most used by plugins...
688686

689-
// Create or update an global variables (and instance properties)
690-
setvar(name: string, value: any): void
687+
// Defines or updates an instance property or method
688+
def(name: string, value: any): void
691689

692690
// Update or reset the palette color
693691
// example: pal(['#000', '#FFF']) is a 1-bit color palette
694692
// example: pal() resets the default color palette
695693
pal(index: string[]): void
696694

697-
// Gets the color value given its index.
698-
// example: getcolor(0) returns "#111"
699-
getcolor(index: number): string
700-
701695
// shutdown the engine
702696
// also emits the "quit" event
703-
quit(): void</code></pre>
697+
quit(): void
698+
699+
// use `stat() to get internal informations about an litecanvas' instance
700+
// stat(0) the settings passed to that instance
701+
// stat(1) returns true if the "init" event has already been emitted
702+
// stat(2) the current ID returned by last requestAnimationFrame
703+
// stat(3) the current canvas element scale (not the context 2D scale)
704+
// stat(4) the attached event callbacks
705+
// stat(5) the current color palette
706+
// stat(6) the default sound used by `sfx()`
707+
// stat(7) the current time scale
708+
// stat(8) the current volume used by ZzFX
709+
// stat(9) the current RNG state
710+
// stat(10) the current font size
711+
// stat(11) the current font family
712+
// any other value returns undefined
713+
stat(n: number): any</code></pre>
704714

705715
<h2><a id="advanced">Playground Features</a></h2>
706716

public/app.js

Lines changed: 157 additions & 157 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)