Test sprite from script

This commit is contained in:
2026-06-02 09:32:07 -05:00
parent 57766a9104
commit a25871a849
38 changed files with 1913 additions and 377 deletions
+22 -4
View File
@@ -1,8 +1,26 @@
// Load rosa.
Console.print('Asset time');
const entry = Asset.lock('rosa.png', Asset.TYPE_TEXTURE, Texture.FORMAT_RGBA);
Asset.requireLoaded(entry);
Console.print('Asset loaded');
// Camera at (3,3,3) looking at origin
const cam = Entity.create();
const pos = cam.add(Component.POSITION);
const camPos = cam.add(Component.POSITION);
cam.add(Component.CAMERA);
camPos.localPosition = new Vec3(3, 3, 3);
camPos.lookAt(new Vec3(0, 0, 0));
pos.localPosition = new Vec3(3, 3, 3);
pos.lookAt(new Vec3(0, 0, 0));
// Test entity at origin
const testEntity = Entity.create();
const testPos = testEntity.add(Component.POSITION);
Console.print('Camera entity ID: ' + cam.toString());
/** @type {RenderableSpritebatch} */
const testRenderable = testEntity.add(Component.RENDERABLE);
testRenderable.type = Renderable.SPRITEBATCH;
testRenderable.setTexture(entry.texture);
testRenderable.addSprite(
0, 0, 1, 1,
0, 0, 1, 1
);
testPos.localPosition = new Vec3(0, 0, 0);