Skip to content

Commit 94be471

Browse files
committed
update engine
1 parent 2a2b15a commit 94be471

File tree

7 files changed

+148
-138
lines changed

7 files changed

+148
-138
lines changed

public/about.html

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,7 @@ <h2><a id="settings">Game Configuration</a></h2>
371371

372372
<h2><a id="globals">Global Variables</a></h2>
373373

374-
<pre><code class="language-typescript">// the game canvas
375-
CANVAS: HTMLCanvasElement
376-
377-
// the amount of time since the game started
374+
<pre><code class="language-typescript">// the amount of time since the game started
378375
T: number
379376

380377
// the game screen width
@@ -383,12 +380,6 @@ <h2><a id="globals">Global Variables</a></h2>
383380
// the game screen height
384381
H: number
385382

386-
// the center X of game screen
387-
CX: number
388-
389-
// the center Y of game screen
390-
CY: number
391-
392383
// the current mouse's X-position
393384
// or -1 (if the mouse was not used or detected)
394385
MX: number
@@ -665,7 +656,10 @@ <h2><a id="engine-api">Engine API</a></h2>
665656

666657
<p>The following functions are most used internally, but also very useful when creating plugins.</p>
667658

668-
<pre><code class="language-typescript">// Loads a plugin.
659+
<pre><code class="language-typescript">// gets the canvas
660+
canvas(): HTMLCanvasElement
661+
662+
// Loads a plugin.
669663
// see: https://github.com/litecanvas/game-engine/blob/main/samples/plugin-basics/plugin-basics.js
670664
use(callback): void
671665

public/app.js

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

public/litecanvas.js

Lines changed: 126 additions & 105 deletions
Large diffs are not rendered by default.

public/preview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
const instance = _litecanvas(settings);
9595
instance.use(pluginMigrate);
9696
instance.use(pluginFrameRateMeter, {
97-
hidden: true,
97+
hidden: false,
9898
});
9999
instance.listen("before:init", () => {
100100
instance.use(pluginAssetLoader);

public/sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const cacheName = "luizbills.litecanvas-editor-v1";
2-
const version = "2025.06.20.2";
2+
const version = "2025.06.22.0";
33

44
const precacheResources = [
55
"/",

src/completions.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,13 @@ export default function customCompletions(context) {
66
from: word.from,
77
options: [
88
// global constants
9-
{ label: "CANVAS", type: "constant", info: "game canvas HTML element" },
109
{ label: "W", type: "variable", info: "width of the game screen" },
1110
{ label: "H", type: "variable", info: "height of the game screen" },
1211
{
1312
label: "T",
1413
type: "variable",
1514
info: "seconds since the game started",
1615
},
17-
{
18-
label: "CX",
19-
type: "variable",
20-
info: "middle X of the game screen",
21-
},
22-
{
23-
label: "CY",
24-
type: "variable",
25-
info: "middle Y of the game screen",
26-
},
2716
{
2817
label: "MX",
2918
type: "variable",
@@ -405,6 +394,12 @@ export default function customCompletions(context) {
405394
detail: "(value)",
406395
info: "Sets the scale of the game's delta time (dt)",
407396
},
397+
{
398+
label: "canvas",
399+
type: "function",
400+
apply: "canvas()",
401+
info: "returns the canvas",
402+
},
408403
{
409404
label: "use",
410405
type: "function",

src/demo.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ let bg, color, radius, posx, posy
1414
function init() {
1515
bg = 0 // the color #0 (black)
1616
color = 3 // the color #3 (white)
17-
radius = W / 10 // the canvas width/10
18-
posx = CX // center X (or canvas width/2)
19-
posy = CY // center Y (or canvas width/2)
17+
radius = W / 10 // canvas.width / 10
18+
posx = W / 2 // center X or canvas.width / 2
19+
posy = H / 2 // center Y or canvas.height / 2
2020
}
2121
2222
// this function detect clicks/touches
@@ -29,7 +29,7 @@ function tapped(x, y) {
2929
3030
// put the game logic in this function
3131
function update(dt) {
32-
// make the circle falls 100 pixels per second
32+
// make the circle falls 200 pixels per second
3333
posy += 200 * dt
3434
}
3535

0 commit comments

Comments
 (0)