fix image smooting & size
This commit is contained in:
parent
275aaed941
commit
74332ca1a0
@ -9,7 +9,7 @@ export class Gamelib {
|
|||||||
this.canvas.width = this.width;
|
this.canvas.width = this.width;
|
||||||
this.canvas.height = this.height;
|
this.canvas.height = this.height;
|
||||||
this.cx = this.canvas.getContext("2d");
|
this.cx = this.canvas.getContext("2d");
|
||||||
this.cx.imageSmootingEnabled = false;
|
this.cx.imageSmoothingEnabled = false;
|
||||||
this.loopInterval = null;
|
this.loopInterval = null;
|
||||||
|
|
||||||
this.keysPressed = new Set();
|
this.keysPressed = new Set();
|
||||||
@ -147,7 +147,8 @@ export class Gamelib {
|
|||||||
image.onload = () => {
|
image.onload = () => {
|
||||||
const sprite = this.spriteCache.get(spriteId);
|
const sprite = this.spriteCache.get(spriteId);
|
||||||
const spriteCx = sprite.getContext("2d");
|
const spriteCx = sprite.getContext("2d");
|
||||||
spriteCx.drawImage(image, 0, 0);
|
spriteCx.imageSmoothingEnabled = false;
|
||||||
|
spriteCx.drawImage(image, 0, 0, width, height);
|
||||||
|
|
||||||
const invalidatedKeys = this.spriteCache.keys()
|
const invalidatedKeys = this.spriteCache.keys()
|
||||||
.filter((key) => key.startsWith(`${spriteId}r`));
|
.filter((key) => key.startsWith(`${spriteId}r`));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user