forked from github/game-off-2012
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
96 lines (82 loc) · 3.15 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
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html>
<head>
<title>Game off 2012</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="underscore/underscore-min.js"></script>
<script type="text/javascript" src="gl-matrix/gl-matrix-min.js"></script>
<script type="text/javascript" src="webgl-utils.js"></script>
<script type="text/javascript" src="js/keycodes.js"></script>
<script type="text/javascript" src="js/program-utils.js"></script>
<script type="text/javascript" src="js/storage.js"></script>
<script type="text/javascript" src="js/game.js"></script>
<script type="text/javascript" src="js/drawables.js"></script>
<script type="text/javascript" src="js/sound.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script id="shader-fs" type="x-shader/x-fragment">
precision mediump float;
precision mediump int;
varying vec4 varying_Color; //incomming varying data to the
//frament shader
varying vec2 v_texCoord;
uniform sampler2D s_texture;
uniform float u_isText;
void main (void) {
if(u_isText < 0.5){
vec4 texture = texture2D(s_texture, v_texCoord.st);
gl_FragColor = texture * varying_Color[3];
} else {
gl_FragColor = varying_Color;
}
}
</script>
<script id="shader-vs" type="x-shader/x-vertex">
precision mediump float; // Precision Qualifiers
precision mediump int; // GLSL ES section 4.5.2
uniform mat4 uniform_Projection; // Incomming data used by
uniform mat4 uniform_Model; // Incomming data used by
attribute vec4 attribute_Position; // the vertex shader
attribute vec4 attribute_Color; // uniform and attributes
attribute vec2 a_texCoord;
varying vec4 varying_Color; // Outgoing varying data
// sent to the fragment shader
varying vec2 v_texCoord;
void main(void) {
varying_Color = attribute_Color;
gl_Position = uniform_Projection * uniform_Model * attribute_Position;
v_texCoord = a_texCoord;
gl_PointSize = 1.5;
}
</script>
</head>
<body>
<div id="canvas">
<canvas id="the-canvas" width="920" height="600" style="border: none;"></canvas>
</div>
<div id="controls1" class="help">
Player 1 controls: left and right arrow keys
</div>
<div id="controls2" class="help">
Player 2 controls: A and D
</div>
<div id="restart" class="help">
Restart game: space
</div>
<div id="restart" class="help">
Toggle sound: S <br />Sound works only in <a href="http://caniuse.com/#feat=audio-api">browsers that support Web Audio</a>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-4205070-28']);
_gaq.push(['_setDomainName', 'github.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>