forked from HeartLine/heartline.github.com
-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
executable file
·78 lines (67 loc) · 2.28 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<html>
<head>
<link href='style/main.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="wrapper" width="800" height"600">
HEARTLINE<br/>
<canvas id="gamecanvas" width="800" height="512"></canvas><br/>
<a id="click" href="#">Full Screen</a>
</div>
<br/>
<br/>
<script src='js/jquery.min.js'></script>
<script src='js/soundmanager2-nodebug-jsmin.js'></script>
<script src='js/room.js'></script>
<script src='js/entitymanager.js'></script>
<script src='js/entity.js'></script>
<script src='js/player.js'></script>
<script src='js/goo.js'></script>
<script src='js/door.js'></script>
<script src='js/heart.js'></script>
<script src='js/fire.js'></script>
<script src='js/smoke.js'></script>
<script src='js/grate.js'></script>
<script src='js/fan.js'></script>
<script src='js/breakable.js'></script>
<script src='js/goal.js'></script>
<script src='js/controller.js'></script>
<script src='js/assetmanager.js'></script>
<script src='js/game.js'></script>
<script src='js/images.js'></script>
<script src='js/sounds.js'></script>
<script src='js/levels.js'></script>
<script>
var div = document.getElementById("wrapper");
var link = document.getElementById("click");
function fs()
{
console.log("fs")
if (document.webkitIsFullScreen)
document.webkitExitFullscreen()
else
div.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
link.onclick = fs;
var canvas = document.getElementById("gamecanvas");
var defaultHeight = canvas.height;
var defaultWidth = canvas.width;
var ctx = canvas.getContext("2d");
window.onresize = function() {
console.log("resize");
var newHeight = window.innerHeight - 150;
var newWidth = window.innerWidth - 10;
console.log(newHeight, newWidth)
if (1.0 * defaultWidth / defaultHeight > 1.0 * newWidth / newHeight)
newHeight = 1.0 * newWidth / defaultWidth * defaultHeight
else
newWidth = 1.0 * newHeight / defaultHeight * defaultWidth;
canvas.height = newHeight;
canvas.width = newWidth;
ctx.scale(1.0 * newWidth/defaultWidth, 1.0 * newHeight/defaultHeight)
}
window.onresize();
//div.mozRequestFullScreen();
</script>
</body>
</html>