fix snippet + catch loop errors
This commit is contained in:
parent
d9a20c6304
commit
264a918ff3
@ -129,7 +129,7 @@ lib.startGameLoop(loop);
|
||||
<div id="sprite-editor-preview">
|
||||
<p id="sprite-editor-preview-title"></p>
|
||||
<img id="sprite-editor-preview-image" src="">
|
||||
<code id="sprite-editor-preview-snippet">test</code>
|
||||
<code id="sprite-editor-preview-snippet"></code>
|
||||
</div>
|
||||
<button id="sprite-editor-upload-button">Upload new sprite</button>
|
||||
<ul id="sprite-editor-sprite-list"></ul>
|
||||
|
@ -37,7 +37,11 @@ export class Gamelib {
|
||||
const now = Date.now();
|
||||
const deltaT = (now - before) / 1000;
|
||||
before = now;
|
||||
loopFunction(deltaT);
|
||||
try {
|
||||
loopFunction(deltaT);
|
||||
} catch (error) {
|
||||
this.console.log(error);
|
||||
}
|
||||
}, 16);
|
||||
|
||||
if (this.codeStopper.isStopped()) {
|
||||
|
@ -59,7 +59,7 @@ export class SpriteEditor {
|
||||
this.preview.image.src = `data:${sprite.mime};base64,${sprite.bytes.toBase64()}`;
|
||||
|
||||
const sanitizedName = sprite.name.replace(/</g, "<").replace(/&/g, "&");
|
||||
this.preview.snippet.innerHTML = "lib.drawImage(<br>" +
|
||||
this.preview.snippet.innerHTML = "lib.drawSprite(<br>" +
|
||||
" x, y,<br>" +
|
||||
" width, height,<br>" +
|
||||
` "${sanitizedName}"<br>` +
|
||||
|
@ -50,14 +50,13 @@ section canvas {
|
||||
}
|
||||
|
||||
section {
|
||||
border-bottom-left-radius: 0.5rem;
|
||||
border-bottom-right-radius: 0.5rem;
|
||||
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1);
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
section > :last-child {
|
||||
flex: 1;
|
||||
border-bottom-left-radius: 0.5rem;
|
||||
border-bottom-right-radius: 0.5rem;
|
||||
}
|
||||
|
||||
div#buttons {
|
||||
|
Loading…
x
Reference in New Issue
Block a user