summaryrefslogtreecommitdiffstats
path: root/src/view
diff options
context:
space:
mode:
Diffstat (limited to 'src/view')
-rw-r--r--src/view/entity.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/view/entity.ts b/src/view/entity.ts
index 6241387..421a238 100644
--- a/src/view/entity.ts
+++ b/src/view/entity.ts
@@ -1,16 +1,16 @@
+import { EntityData } from '../model/data/entity';
import { Renderer } from './renderer/renderer';
import { SpriteView, SpriteViewBuilder } from './sprite';
import { loadImage, mkTexture } from './util/image';
-export async function loadSimpleEntity(
+export async function loadEntity(
r: Renderer,
- sprite: string,
- anchor: [number, number] = [0.5, 0.5],
+ data: EntityData,
): Promise<SpriteView> {
- const tile = await loadImage(`resources/sprite/entity/${sprite}.png`);
+ const tile = await loadImage(`resources/sprite/entity/${data.sprite}.png`);
const texture = mkTexture(r.getContext(), tile);
- const [x, y] = anchor;
+ const [x, y] = data.anchor;
const builder = new SpriteViewBuilder(r, texture);
builder.addSprite([-x, -y, -x + 1, -y + 1], [0, 0, 1, 1]);