Files
dusk/assets/testentity.js
T
2026-06-02 09:32:07 -05:00

27 lines
797 B
JavaScript

// 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 camPos = cam.add(Component.POSITION);
cam.add(Component.CAMERA);
camPos.localPosition = new Vec3(3, 3, 3);
camPos.lookAt(new Vec3(0, 0, 0));
// Test entity at origin
const testEntity = Entity.create();
const testPos = testEntity.add(Component.POSITION);
/** @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);