Test sprite from script
This commit is contained in:
+22
-4
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user