Skip to content

Commit 670243f

Browse files
authored
Add files via upload
1 parent a49a2f3 commit 670243f

File tree

94 files changed

+26807
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+26807
-0
lines changed

codebase/Mario.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
start "" http://ProcessingJS.NihongoResources.com/test/PjsGameEngine/

codebase/canvasFocus.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use strict";
2+
3+
document.addEventListener('DOMContentLoaded', () => {
4+
const canvas = document.querySelector('canvas');
5+
6+
canvas.addEventListener('focus', function () { // while focussed, play sketch
7+
const sketch = Processing.getInstanceById(this.id);
8+
if (sketch) sketch.loop(), sketch.unmute();
9+
});
10+
11+
canvas.addEventListener('blur', function () { // when focus's lost, pause sketch
12+
const sketch = Processing.getInstanceById(this.id);
13+
if (sketch) sketch.noLoop(), sketch.mute();
14+
});
15+
});

0 commit comments

Comments
 (0)