The great move >.<

This commit is contained in:
kolaflash
2026-02-05 22:26:34 +01:00
parent 175ea1b726
commit 083cb70fbe
90 changed files with 85 additions and 137 deletions
+14
View File
@@ -0,0 +1,14 @@
{
"name": "barScene",
"width": 240,
"height": 160,
"entities": [
{
"name": "hero",
"position": {
"x": 0,
"y": 0
}
}
]
}
+8
View File
@@ -0,0 +1,8 @@
import { defineScene } from "#/engine/Scene.ts";
import data from "./data.json";
const { process, linkScenes } = defineScene(data);
linkScenes(["testScene"] as const);
process((_ctx, _delta) => {});
+21
View File
@@ -0,0 +1,21 @@
{
"name": "fooScene",
"width": 80,
"height": 48,
"entities": [
{
"name": "hero",
"position": {
"x": 0,
"y": 0
}
},
{
"name": "testEntity",
"position": {
"x": 24,
"y": 16
}
}
]
}
+8
View File
@@ -0,0 +1,8 @@
import { defineScene } from "#/engine/Scene.ts";
import data from "./data.json";
const { process, linkScenes } = defineScene(data);
linkScenes(["barScene"] as const);
process((_ctx, _delta) => {});
+28
View File
@@ -0,0 +1,28 @@
{
"name": "testScene",
"width": 80,
"height": 48,
"entities": [
{
"name": "hero",
"position": {
"x": 0,
"y": 0
}
},
{
"name": "portal",
"position": {
"x": 16,
"y": 16
}
},
{
"name": "testEntity",
"position": {
"x": 32,
"y": 32
}
}
]
}
+33
View File
@@ -0,0 +1,33 @@
import { pointer } from "#/engine/Pointer.ts";
import { defineScene } from "#/engine/Scene.ts";
import type { Vector } from "#/engine/Vector.ts";
import data from "./data.json";
const { process, preProcess, linkScenes } = defineScene(data);
linkScenes(["fooScene"] as const);
preProcess((entityInstanceMap) => {
const entity = entityInstanceMap.get(data.entities[0].name);
const instance = entity!.instances[0];
instance.position.x = data.width - 16;
instance.position.y = data.height - 16;
});
function drawPoint(
ctx: CanvasRenderingContext2D,
position: Vector,
radius: number = 4,
): void {
ctx.beginPath();
ctx.arc(position.x, position.y, radius, 0, 2 * Math.PI);
ctx.strokeStyle = "#ff9000";
ctx.stroke();
}
process((ctx, delta) => {
if (!pointer.isDown) {
drawPoint(ctx, pointer.position);
}
});