Skip to content

Commit a5635ed

Browse files
committed
- #16 change
canvas-appearing behaviour. Seems to break resizing love callback unless special canvas properties are set (see issue) - better error reporting - websocket API support (in theory?)
1 parent 2c6c604 commit a5635ed

File tree

7 files changed

+35
-21
lines changed

7 files changed

+35
-21
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"postversion": "git push && git push --tags"
1616
},
1717
"bin": {
18-
"love-js": "./index.js"
18+
"love.js": "./index.js"
1919
},
2020
"repository": {
2121
"type": "git",

src/compat/index.html

+15-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, minimum-scale=1, maximum-scale=1">
67
<title>{{title}}</title>
78

89
<!-- Load custom style sheet -->
@@ -12,20 +13,25 @@
1213
<center>
1314
<div>
1415
<h1>{{title}}</h1>
15-
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
1616
<canvas id="loadingCanvas" oncontextmenu="event.preventDefault()" width="800" height="600"></canvas>
17+
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
1718
</div>
1819
</center>
1920

2021
<script type='text/javascript'>
2122
function goFullScreen(){
22-
var canvas = document.getElementById("canvas");
23-
if(canvas.requestFullScreen)
24-
canvas.requestFullScreen();
25-
else if(canvas.webkitRequestFullScreen)
26-
canvas.webkitRequestFullScreen();
27-
else if(canvas.mozRequestFullScreen)
28-
canvas.mozRequestFullScreen();
23+
var canvas = document.getElementById("canvas");
24+
if(canvas.requestFullScreen)
25+
canvas.requestFullScreen();
26+
else if(canvas.webkitRequestFullScreen)
27+
canvas.webkitRequestFullScreen();
28+
else if(canvas.mozRequestFullScreen)
29+
canvas.mozRequestFullScreen();
30+
}
31+
function FullScreenHook(){
32+
var canvas = document.getElementById("canvas");
33+
canvas.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
34+
canvas.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
2935
}
3036
var loadingContext = document.getElementById('loadingCanvas').getContext('2d');
3137
function drawLoadingText(text) {
@@ -69,7 +75,7 @@ <h1>{{title}}</h1>
6975
drawLoadingText(text);
7076
} else if (Module.remainingDependencies === 0) {
7177
document.getElementById('loadingCanvas').style.display = 'none';
72-
document.getElementById('canvas').style.display = 'block';
78+
document.getElementById('canvas').style.visibility = 'visible';
7379
}
7480
},
7581
totalDependencies: 0,

src/compat/love.wasm

88 Bytes
Binary file not shown.

src/compat/theme/love.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ a:hover {
4343
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
4444
#canvas {
4545
padding-right: 0;
46-
display: none;
46+
display: display;
4747
border: 0px none;
48+
visibility: hidden;
4849
}

src/release/index.html

+15-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, minimum-scale=1, maximum-scale=1">
67
<title>{{title}}</title>
78

89
<!-- Load custom style sheet -->
@@ -12,20 +13,25 @@
1213
<center>
1314
<div>
1415
<h1>{{title}}</h1>
15-
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
1616
<canvas id="loadingCanvas" oncontextmenu="event.preventDefault()" width="800" height="600"></canvas>
17+
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
1718
</div>
1819
</center>
1920

2021
<script type='text/javascript'>
2122
function goFullScreen(){
22-
var canvas = document.getElementById("canvas");
23-
if(canvas.requestFullScreen)
24-
canvas.requestFullScreen();
25-
else if(canvas.webkitRequestFullScreen)
26-
canvas.webkitRequestFullScreen();
27-
else if(canvas.mozRequestFullScreen)
28-
canvas.mozRequestFullScreen();
23+
var canvas = document.getElementById("canvas");
24+
if(canvas.requestFullScreen)
25+
canvas.requestFullScreen();
26+
else if(canvas.webkitRequestFullScreen)
27+
canvas.webkitRequestFullScreen();
28+
else if(canvas.mozRequestFullScreen)
29+
canvas.mozRequestFullScreen();
30+
}
31+
function FullScreenHook(){
32+
var canvas = document.getElementById("canvas");
33+
canvas.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
34+
canvas.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
2935
}
3036
var loadingContext = document.getElementById('loadingCanvas').getContext('2d');
3137
function drawLoadingText(text) {
@@ -69,7 +75,7 @@ <h1>{{title}}</h1>
6975
drawLoadingText(text);
7076
} else if (Module.remainingDependencies === 0) {
7177
document.getElementById('loadingCanvas').style.display = 'none';
72-
document.getElementById('canvas').style.display = 'block';
78+
document.getElementById('canvas').style.visibility = 'visible';
7379
}
7480
},
7581
totalDependencies: 0,

src/release/love.wasm

88 Bytes
Binary file not shown.

src/release/theme/love.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ a:hover {
4343
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
4444
#canvas {
4545
padding-right: 0;
46-
display: none;
46+
display: display;
4747
border: 0px none;
48+
visibility: hidden;
4849
}

0 commit comments

Comments
 (0)