-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
127 lines (107 loc) · 2.7 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="p5.js demo project">
<meta name="author" content="sero">
<meta name="theme-color" content="#111">
<title>welcome to the magic city *_*</title>
<script src="libs/p5.js"></script>
<script src="libs/p5.sound.js"></script>
<script src="libs/jquery.min.js"></script>
<script src="libs/jquery-ui.min.js"></script>
<script src="scripts/magiccity.js"></script>
<link type="text/css" rel="stylesheet" href="styles/jquery-ui.min.css">
<link type="text/css" rel="stylesheet" href="styles/style.css">
</head>
<body>
<div id="p5_loading" class="loadingclass">
<h1>loading</h1>
</div>
<div id="info" class="infoclass">
<h1>allow microphone access<br> + press any key</h1>
</div>
<main role="main" class="main-content"></main>
<script type="text/javascript">
// checked variables below this line
var city;
p5.disableFriendlyErrors = true;
var imageTexture1,
imageTexture2,
textureTrainLogo,
textureBerlin,
snowflakes = [],
debugFpsSum = 0,
debugFpsCount,
animationStarted;
function preload()
{
imageTexture1 = loadImage('images/texture3.png');
imageTexture2 = loadImage('images/texture3.png');
textureBerlin = loadImage('images/ber_wappen.png');
textureTrainLogo = loadImage('images/corporate.png');
}
function setup()
{
createCanvas(windowWidth, windowHeight, WEBGL);
pixelDensity(1);
animationStarted = false;
setAttributes('premultipliedAlpha', true);
frameRate(30);
city = new magicCity();
if (windowWidth < 1200 || windowHeight < 600) {
$('#info').hide();
let error = 'Come back when your screen is bigger.';
city.showDialog('cute but no', error);
animationStarted = true;
throw new Error(error);
}
debugFpsArray = [];
}
function startDraw() {
getAudioContext().resume();
animationStarted = true;
if (localStorage.getItem('drawBlock') === null) {
city.setup();
}
else {
city.showDialog('You destroyed the world', 'You didn\'t listen to me, now see what you did<br><br>=(', '', function () {
});
city.draw = function () {
};
}
}
function mouseClicked() {
if (animationStarted) {
return;
}
$('#info').fadeOut('slow', function () {
startDraw();
});
}
function keyPressed() {
if (animationStarted) {
return;
}
$('#info').fadeOut('slow', function () {
startDraw();
});
}
function windowResized()
{
if (city && city.setupExecuted) {
city.earthquake();
}
}
var draw = function ()
{
if (animationStarted) {
city.draw();
}
// city.drawDebug();
};
</script>
</body>
</html>