-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
83 lines (68 loc) · 2.34 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
79
80
81
82
83
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body onload="start()">
<div class="wrapper">
<canvas id="glcanvas" width="900" height="800">
Your browser doesn't appear to support the
<code><canvas></code> element.
</canvas>
<input id="numberOfTeapots" type=range min=0 max=10000 value=1>
<input id="teapotResolution" type=range min=0 max=4 value=1>
</div>
<div id="includedContent"></div>
<script src='libs/jquery/jquery-3.1.0.min.js'></script>
<link rel="import" href="libs/gl-matrix/gl-MatrixInclude.html">
<link rel="import" href="libs/obj-loader/obj-loaderInclude.html">
<link rel="import" href="libs/statsjs/StatsInclude.html">
<link rel="import" href="src/framework/FrameworkInclude.html">
<link rel="import" href="src/game/GameInclude.html">
<script>
$(function ()
{
/* Mouse Events */
$('#glcanvas')
.mousedown(MouseManager.onMouseDown)
.mouseup(MouseManager.onMouseUp)
.mousemove(MouseManager.onMouseMove);
/* Temporary touch events for demo */
$('#glcanvas').on('touchstart', function (e)
{
e.button = MouseManager.LEFT_STD_BUTTON;
e.screenX = e.originalEvent.touches[0].screenX;
e.screenY = e.originalEvent.touches[0].screenY;
e.preventDefault();
MouseManager.onMouseDown(e);
});
$('#glcanvas').on('touchmove', function (e)
{
e.screenX = e.originalEvent.touches[0].screenX;
e.screenY = e.originalEvent.touches[0].screenY;
e.preventDefault();
MouseManager.onMouseMove(e);
});
$('#glcanvas').on('touchend', function (e)
{
e.button = MouseManager.LEFT_STD_BUTTON;
e.screenX = 400;//garbage
e.screenY = 400;//garbage
e.preventDefault();
MouseManager.onMouseUp(e);
});
});
function start()
{
var canvas = document.getElementById("glcanvas")
var gameScreen = new GameScreen();
var loadingScreen = new LoadingScreen();
var game = new Game(loadingScreen, 1);
game.addScreen(gameScreen, 2);
var application = new Application(game, canvas);
application.performGameLoop();
}
</script>
</body>
</html>