forked from gn-math/assets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
235 lines (220 loc) · 8.3 KB
/
index.html
File metadata and controls
235 lines (220 loc) · 8.3 KB
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<html lang="en">
<head>
<base href="https://cdn.jsdelivr.net/gh/gn-math/assets@main/311/">
<!--v0.4-->
<title>SANDTRIS</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.6.0/p5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.6.0/addons/p5.sound.min.js"></script>
<script src="sketch.js"></script>
<link rel="icon" type="image/x-icon" href="favicon.png">
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<!-- Header Title -->
<div id="sandtrislogo">
<h1 >SANDTRIS</h1>
</div>
<div id="main2">
<!-- Ads - Left Column -->
<div class="adsbox">
ads!
<div class="ad">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9200311124038960" crossorigin="anonymous"></script>
<!-- top sandtris ad -->
<ins class="adsbygoogle" style="display:inline-block;width:200px;height:310px" data-ad-client="ca-pub-9200311124038960" data-ad-slot="4677385647"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<div class="ad">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9200311124038960" crossorigin="anonymous"></script>
<!-- bottom sandtris ad -->
<ins class="adsbygoogle" style="display:inline-block;width:200px;height:310px" data-ad-client="ca-pub-9200311124038960" data-ad-slot="1316725130"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
<!-- Game Canvas - Middle Column -->
<div id="cnv">
<!-- Various Dialog Pages -->
<dialog id="aboutpage" class="page" close>
<div class="box">
<div class="logo is-animation">
<span>S</span>
<span>A</span>
<span>N</span>
<span>D</span>
<span>T</span>
<span>R</span>
<span>I</span>
<span>S</span>
</div>
<p>MADE BY <a href="https://francomiranda.com/" target="_blank">FRANCO MIRANDA</a> USING P5.JS</p>
<p>INSPIRED BY SETRIS BY <a href="https://itch.io/profile/mslivo" target="_blank">MSLIVO</a></p>
<br/>
<u>CONTROLS</u>
<br/>
<table style="font-size: 12px">
<tbody>
<tr>
<td>Move Block:</td>
<td>Left/Right Arrows</td>
</tr>
<tr>
<td>Spin Block: </td>
<td>Up Arrow</td>
</tr>
<tr>
<td>Move Down Faster: </td>
<td>Down Arrow</td>
</tr>
<tr>
<td>Move Sideways Faster: </td>
<td>Shift/Ctrl</td>
</tr>
<tr>
<td>Pause: </td>
<td>P</td>
</tr>
</tbody>
</table>
<p>Connect the same color <br/> across the screen to clear lines!</p>
<br/>
<p>NOT AFFILIATED WITH Tetris®</p>
<br/>
<button type="button" class="redbutton" onClick="toggleAbout()">X</button>
</div>
</dialog>
<dialog id="startpage" class="page" open>
<div class="box">
Welcome to
<div class="logo is-animation">
<span>S</span>
<span>A</span>
<span>N</span>
<span>D</span>
<span>T</span>
<span>R</span>
<span>I</span>
<span>S</span>
</div>
<br/>
<button type="button" class="greenbutton" onClick="startGame()">START</button>
<button type="button" class="redbutton" onClick="toggleAbout()">ABOUT</button>
<br/><br/>
<div style="display: grid; width:300px; grid-template-columns: auto auto;">
<div>
<p id="musicText" style="margin:0px; padding:5px;">MUS</p>
<input style="width:120px" type="range" min="0" max="10" value="1" class="slider" id="mus1Slider" onchange="MUSvolume(this.value)"/>
</div>
<div>
<p id="soundText" style="margin:0px; padding:5px;">SFX</p>
<input style="width:120px" type="range" min="0" max="10" value="1" class="slider" id="sfx1Slider" onchange="SFXvolume(this.value)"/>
</div>
</div>
<p style="font-size: 12px; color:bisque">now works on mobile!</p>
</div>
</dialog>
<dialog id="pausepage" class="page" close>
<div class="box">
<br/>
PAUSED
<br/><br/>
<button type="button" class="redbutton" onClick="unpauseGame()">RESUME</button>
<br/><br/>
<button type="button" class="bluebutton" onClick="newGame()">NEW GAME</button>
<br/><br/>
MUS
<input style="width:80px" type="range" min="0" max="10" value="1" class="slider" id="mus2Slider" onchange="MUSvolume(this.value)"/>
<br/>
SFX
<input style="width:80px" type="range" min="0" max="10" value="0.5" class="slider" id="sfx2Slider" onchange="SFXvolume(this.value)"/>
</div>
</dialog>
<dialog id="gameoverpage" class="page" close>
<div class="box">
<br/><br/>
GAME OVER
<br/>
<p id="gameoverText"></p>
<button type="button" class="greenbutton" onClick="newGame()">NEW GAME</button>
<br/><br/>
<button type="button" class="bluebutton" onClick="shareText()">share</button>
<br/><br/>
<div style="width:400px">
<h4>SUBMIT YOUR SCORE:</h4>
<span>
<input type="text" class="namebox" id="name" placeholder="enter your name" maxlength="16">
<button class="submitbutton" onclick="submitScore()">Submit</button>
</span>
<p id="responseBox" style="font-size: 12px"></p>
</div>
</div>
</dialog>
<dialog id="mobile-controls" class="page" open>
<button class="mobile-button"
style="top:32px; left:192px;"
ontouchstart="setButton('rotate', true)"
ontouchend="setButton('rotate', false)">
<i class="fa fa-rotate-right" style="font-size:32px;"></i>
</button>
<button class="mobile-button"
style="top:32px; left:64px;"
ontouchstart="setButton('fast', true)"
ontouchend="setButton('fast', false)">
<i class="fa fa-forward" style="font-size:32px;"></i>
</button>
<button class="mobile-button"
style="top:128px; left:128px;"
ontouchstart="setButton('down', true)"
ontouchend="setButton('down', false)">
<i class="fa fa-arrow-down style="font-size:32px;"></i>
</button>
<button class="mobile-button"
style="top:96px; right:192px;"
ontouchstart="setButton('left', true)"
ontouchend="setButton('left', false)">
<i class="fa fa-arrow-left" style="font-size:32px;"></i>
</button>
<button class="mobile-button"
style="top:96px; right:64px;"
ontouchstart="setButton('right', true)"
ontouchend="setButton('right', false)">
<i class="fa fa-arrow-right" style="font-size:32px;"></i>
</button>
</dialog>
<div id="p5_loading">LOADING</div>
</div>
<!-- Leaderboard - Right Column -->
<div class="adsbox">
Weekly Leaderboard
<div id="leaderboard-list"></div>
Your Rank
<div id="bestScoreEntry" class="leaderboard"></div>
</div>
</div>
<script>
function scaleDiv() {
//
var container = document.getElementById('cnv');
var baseWidth = parseFloat(getComputedStyle(document.documentElement)
.getPropertyValue('--base-width'));
var viewportWidth = window.innerWidth;
var scaleFactor = viewportWidth / baseWidth;
if( scaleFactor > 1){
scaleFactor = 1;
}
container.style.transform = 'scale(' + scaleFactor + ')';
container = document.getElementById('sandtrislogo');
container.style.transform = 'scale(' + scaleFactor + ')';
container.style.height = 100*scaleFactor;
}
window.onload = scaleDiv;
window.onresize = scaleDiv;
</script>
</body>
</html>