-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
204 lines (171 loc) · 7.85 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!DOCTYPE html>
<html>
<head>
<title>curvy</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script id="3d-vertex-shader" type="x-shader/x-vertex">
precision highp float;
attribute vec3 aPosition;
attribute vec3 aNormal;
attribute vec2 aTextureCoord;
uniform mat4 uProjectionMatrix;
uniform mat4 uModelviewMatrix;
uniform mat4 uNormalMatrix;
uniform vec4 uColor;
varying vec2 vTextureCoord;
varying vec3 vLighting;
varying vec4 vColor;
void main() {
gl_Position = uProjectionMatrix * uModelviewMatrix * vec4(aPosition, 1.0);
vec3 ambientLight = vec3(1,1,1) * 0.8;
vec3 directionalLightColor = vec3(1, 1, 1) * 0.4;
vec3 directionalVector = vec3(0.85, 0.8, 0.75);
vec4 transformedNormal = uNormalMatrix * vec4(aNormal, 1.0);
float directional = max(dot(transformedNormal.xyz, directionalVector), 0.0);
vLighting = ambientLight + (directionalLightColor * directional);
vTextureCoord = aTextureCoord;
vColor = uColor;
}
</script>
<script id="3d-fragment-shader" type="x-shader/x-fragment">
precision highp float;
varying vec3 vLighting;
varying vec2 vTextureCoord;
varying vec4 vColor;
uniform sampler2D uSampler;
uniform bool uTextureEnabled;
void main() {
vec4 texel;
if (uTextureEnabled)
texel = texture2D(uSampler, vTextureCoord);
else
texel = vec4(1,1,1,1);
gl_FragColor = vColor * vec4(texel.rgb * vLighting, texel.a);
}
</script>
</head>
<body>
<div id="wrap">
<div id="loading-screen" class="screen active">
<h1>curvy</h1>
<p id="loading-status">Please enable JavaScript in your browser.</p>
<p id="progress"></p>
<a href="https://github.com/Yogu/curvy" id="fork-me-ribbon"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/52760788cde945287fbb584134c4cbc2bc36f904/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"></a>
</div>
<div id="start-screen" class="screen">
<h1>curvy</h1>
<p>Welcome to the curvy ball game!</p>
<h2>How to play</h2>
<ul>
<li>Click to release the ball</li>
<li>Move the paddle quickly for spin</li>
<li>Don't miss the ball!</li>
</ul>
<h2>Singleplayer</h2>
<div class="buttons"><button id="singleplayer">Start Game</button></div>
<h2>Multiplayer</h2>
<div class="form">
<label for="user">Your name:</label>
<input id="user" type="text" value="" placeholder="User Name" />
<button id="login">Login</button>
<button id="logout" disabled="disabled">Logout</button>
</div>
<div class="text">
<p id="network-status">Enter your name and click Login</p>
</div>
<div id="multiplayer-stuff">
<h3>Other Players</h3>
<p id="no-contacts" style="display: none;">There are currently no other players.</p>
<ul id="contacts"></ul>
<div id="button-box" style="display: none;">
</div>
<div id="incoming-calls"></div>
<h3>Chat</h3>
<ul id="chat-messages"></ul>
<form id="chat-form">
<input type="text" id="chat-input">
<button id="chat-submit">Send</button>
</form>
</div>
<a href="https://github.com/Yogu/curvy" id="fork-me-ribbon"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/52760788cde945287fbb584134c4cbc2bc36f904/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"></a>
</div>
<div id="game-screen" class="screen">
<canvas id ="canvas"></canvas>
<div id="score">0 : 0</div>
<div id="game-details">
<span id="status"></span>
<!-- <span id="server-ping"></span> -->
<span id="peer-ping"></span>
</div>
<div id="game-controls">
<button id="fullscreen">Fullscreen</button>
<button id="show-menu">Back to menu</button>
</div>
</div>
</div>
<script type="text/javascript">
document.getElementById('loading-status').innerHTML = 'Please wait while the game is loading...';
window.loadingTimeout = setTimeout(function() {
if (!window.isError)
document.getElementById('loading-status').innerHTML = "That's a little bit too long, probably some error has occurred."
}, 10000);
window.showStatus = function(status) {
console.log('STATUS: ' + status);
clearTimeout(window.loadingTimeout);
if (!window.isError) {
$('#loading-status').html(status);
}
};
window.showError = function(error) {
if (!window.isError) {
window.isError = true;
$('#loading-status').html(error);
$('#progress').hide();
$('body').addClass('error');
window.onerror = null;
}
};
window.onerror = function(message, file, line) {
showError('Oops, something went wrong.<br /><br />Details: ' + message + (file ? ' (' + file + ':' + line + ')' : ''));
};
</script>
<script type="text/javascript" src="scripts/lib/jquery/jquery-1.8.2.js"></script>
<script type="text/javascript" src="scripts/lib/gl-matrix/gl-matrix.js"></script>
<script type="text/javascript" src="scripts/lib/socket.io/socket.io.js"></script>
<script type="text/javascript" src="scripts/rendering/webgl.js"></script>
<script type="text/javascript" src="scripts/rendering/renderer.js"></script>
<script type="text/javascript" src="scripts/rendering/model.js"></script>
<script type="text/javascript" src="scripts/rendering/mesh.js"></script>
<script type="text/javascript" src="scripts/rendering/material.js"></script>
<script type="text/javascript" src="scripts/world/world.js"></script>
<script type="text/javascript" src="scripts/world/body.js"></script>
<script type="text/javascript" src="scripts/world/entity.js"></script>
<script type="text/javascript" src="scripts/world/ball.js"></script>
<script type="text/javascript" src="scripts/world/room.js"></script>
<script type="text/javascript" src="scripts/world/paddle.js"></script>
<script type="text/javascript" src="scripts/world/beam.js"></script>
<script type="text/javascript" src="scripts/world/camera.js"></script>
<script type="text/javascript" src="scripts/network/peer-channel.js"></script>
<script type="text/javascript" src="scripts/network/server-connection.js"></script>
<script type="text/javascript" src="scripts/audio/sound.js"></script>
<script type="text/javascript" src="scripts/ui/screen-control.js"></script>
<script type="text/javascript" src="scripts/ui/loading-screen.js"></script>
<script type="text/javascript" src="scripts/ui/game-screen.js"></script>
<script type="text/javascript" src="scripts/ui/start-screen.js"></script>
<script type="text/javascript" src="scripts/base.js"></script>
<script type="text/javascript" src="scripts/input.js"></script>
<script type="text/javascript" src="scripts/resources.js"></script>
<script type="text/javascript" src="scripts/game.js"></script>
<script type="text/javascript" src="scripts/main.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-55323404-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>