-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
177 lines (121 loc) · 6.08 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<html>
<head>
<link rel="icon" href="https://raw.githubusercontent.com/nmssilva/cv-webgl-spaceinvaders/master/inv.png">
<style>
@font-face {
font-family: ARCADE;
src: url(joystixmonospace.ttf);
}
#contentBox {
margin: 0 auto;
width: 600px;
}
#contentBox .column {
float: left;
margin: 0;
width: 50%;
}
p {
margin: 0;
padding: 0;
}
body {
background: /* top, transparent black, faked with gradient */ linear-gradient(
rgba(0, 0, 0, 0.7),
rgba(0, 0, 0, 0.7)
),
/* bottom, image */ url(https://raw.githubusercontent.com/nmssilva/cv-webgl-spaceinvaders/master/webvadersgl.png);
background-repeat:no-repeat;
background-size:cover;
}
</style>
<title>Webvaders GL</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script id="shader-vs" type="x-shader/x-vertex">
attribute vec3 aVertexPosition;
attribute vec3 aVertexColor;
uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;
varying vec4 vertexColor;
void main(void) {
// To allow seeing the points drawn
gl_PointSize = 5.0;
// Just converting the (x,y,z) vertices to Homogeneous Coord.
// And multiplying by the Projection and the Model-View matrix
gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
// Converting the RGB color value to RGBA
vertexColor = vec4(aVertexColor, 1.0);
}
</script>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-87929398-1']);
_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>
<script id="shader-fs" type="x-shader/x-fragment">
precision mediump float;
varying vec4 vertexColor;
void main(void) {
// Using the passed vertex color
gl_FragColor = vertexColor;
}
</script>
<script type="text/javascript" src="./webgl-utils.js"></script>
<script type="text/javascript" src="./maths.js"></script>
<script type="text/javascript" src="./models.js"></script>
<script type="text/javascript" src="./lightSources.js"></script>
<script type="text/javascript" src="./initShaders.js"></script>
<script type="text/javascript" src="./index.js"></script>
</head>
<body bgcolor="#000000" onload="runWebGL();">
<div style="text-align: center">
<a style="color: #ffffff; font-family: ARCADE; font-size: 33px">Webvaders GL</a> <br>
<table style="margin-left: auto; margin-right: auto;">
<tr>
<td>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
░░░░░░░░░░░░░░░░░<br />
░░░░░▀▄░░░▄▀░░░░░<br />
░░░░▄█▀███▀█▄░░░░<br />
░░░█▀███████▀█░░░<br />
░░░█░█▀▀▀▀▀█░█░░░<br />
░░░░░░▀▀░▀▀░░░░░░<br />
░░░░░░░░░░░░░░░░░<br /></td>
<td><canvas id="my-canvas" style="border:1px solid #222222; background-color: #000;" width="600" height="600"></canvas></td>
<td>░░░░░░░░░░░░░░░░░<br />
░░░▄░▀▄░░░▄▀░▄░░░<br />
░░░█▄███████▄█░░░<br />
░░░███▄███▄███░░░<br />
░░░▀█████████▀░░░<br />
░░░░▄▀░░░░░▀▄░░░░<br />
░░░░░░░░░░░░░░░░░<br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<img id="muteimg" src="nomute.png" width="30" onclick="mute();">
</td>
</tr>
</table>
<br>
<a id="myLink" style="color: #ffffff; font-family: ARCADE;">Press R to begin!</a>
<div id="contentBox">
<div class="column">
<p style="text-align: left; color: #ffffff; font-family: ARCADE;">
Controls: <br>
Move: Arrows or A/D <br>
Shoot: Spacebar or W<br>
Pause: P
</p>
</div>
<div class="column">
<p id="right" style=" text-align: right; color: #ffffff; font-family: ARCADE;">
Level: 1 <br> Points: 0
</p>
</div>
</div>
</div>
</body>
</html>