feat(assets): use single texture atlas instead of loading all images individually
This commit is contained in:
@@ -3,14 +3,16 @@ const props = defineProps<{
|
||||
x: number;
|
||||
y: number;
|
||||
opacity: number;
|
||||
image: HTMLImageElement;
|
||||
image: {
|
||||
draw: (ctx: CanvasRenderingContext2D, x: number, y: number) => void;
|
||||
};
|
||||
}>();
|
||||
|
||||
const { onRender } = useScreen();
|
||||
|
||||
onRender((ctx) => {
|
||||
ctx.globalAlpha = props.opacity;
|
||||
ctx.drawImage(props.image, props.x, props.y);
|
||||
props.image.draw(ctx, props.x, props.y);
|
||||
});
|
||||
|
||||
defineOptions({
|
||||
|
||||
Reference in New Issue
Block a user