forked from redblobgames/mapgen4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
embed.html
219 lines (181 loc) · 6.55 KB
/
embed.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<head>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css"
integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<style>
label {
line-height: 2.5;
}
button {
text-align: center;
padding: 4px;
background: hsl(60, 20%, 90%);
border-radius: 4px;
cursor: pointer;
}
button svg {
width: 100%;
height: 100%;
}
button text {
text-anchor: middle;
font-size: 24px;
font-family: Arial;
font-family: var(--sans-serif);
}
button.current-control {
background: hsl(60, 100%, 80%);
}
button:focus {
outline: none;
}
input[type="range"] {
cursor: ew-resize;
}
button:disabled,
input:disabled {
cursor: unset;
opacity: 0.25;
}
#ui {
display: grid;
min-height: calc(100vmin - 130px);
grid-template-rows: repeat(3, 40px) calc(100vmin - 130px - 120px - 40px);
grid-template-columns: 1fr calc(100vmin - 130px) repeat(6, 20px) 1fr;
grid-row-gap: 10px;
grid-column-gap: 10px;
}
#map {
grid-area: 1 / 2 / span 4 / span 1;
width: 100%;
height: 100%;
}
#small {
grid-area: 1 / 3 / span 1 / span 2;
}
#medium {
grid-area: 1 / 5 / span 1 / span 2;
}
#large {
grid-area: 1 / 7 / span 1 / span 2;
}
#ocean {
grid-area: 2 / 3 / span 1 / span 3;
}
#shallow {
grid-area: 2 / 6 / span 1 / span 3;
}
#valley {
grid-area: 3 / 3 / span 1 / span 3;
}
#mountain {
grid-area: 3 / 6 / span 1 / span 3;
}
#sliders {
grid-area: 4 / 3 / span 1 / span 6;
overflow-y: scroll;
line-height: 1.0;
}
@media (orientation: portrait) {
/* Put the buttons on top instead of on the right */
#ui {
grid-template-rows: repeat(6, 20px) calc(100vmin);
grid-template-columns: 50px repeat(2, 70px) calc(100vmin - 50px - 140px - 40px);
}
#map {
grid-area: 7 / 1 / span 1 / span 6;
}
#small {
grid-area: 1 / 1 / span 2 / span 1;
}
#medium {
grid-area: 3 / 1 / span 2 / span 1;
}
#large {
grid-area: 5 / 1 / span 2 / span 1;
}
#ocean {
grid-area: 1 / 2 / span 3 / span 1;
}
#shallow {
grid-area: 1 / 3 / span 3 / span 1;
}
#valley {
grid-area: 4 / 2 / span 3 / span 1;
}
#mountain {
grid-area: 4 / 3 / span 3 / span 1;
}
#sliders {
grid-area: 1 / 4 / span 6 / span 1;
justify-self: end;
}
}
#mapgen4 {
width: 100%;
height: 100%;
}
#sliders h3 {
background-color: hsl(60, 20%, 90%);
margin: 0.5em 0;
padding: 0.5em;
font-size: 66%;
}
#sliders label {
display: block;
font-size: 66%;
}
#sliders label span {
font-family: monospace;
font-family: var(--monospace);
display: inline-block;
width: 17ch;
}
#button-reset {
display: inline-block;
margin-left: auto;
margin-right: auto;
width: 100%;
height: 2em;
}
</style>
</head>
<div class="width-unlimited">
<div id="ui" class="width-unlimited">
<button id="small"><svg viewBox="-50 -50 100 100">
<circle r="20" /></svg></button>
<button id="medium"><svg viewBox="-50 -50 100 100">
<circle r="35" /></svg></button>
<button id="large"><svg viewBox="-50 -50 100 100">
<circle r="50" /></svg></button>
<button id="ocean" title="Ocean"><svg viewBox="-50 -50 100 100"><text y="45">Ocean</text>
<path d="M -60,-30 Q 0,80 60,-30 z" fill="hsl(240,50%,40%)" /></svg></button>
<button id="shallow" title="Water"><svg viewBox="-50 -50 100 100"><text y="45">Water</text>
<path d="M -60,-10 Q 0,30 60,-10 z" fill="hsl(200,50%,70%)" /></svg></button>
<button id="valley" title="Valley"><svg viewBox="-50 -50 100 100"><text y="45">Valley</text>
<path d="M -60,10 L -50,-10 L 50,-10 L 60,10 z" fill="hsl(100,50%,70%)" /></svg></button>
<button id="mountain" title="Mountain"><svg viewBox="-50 -50 100 100"><text y="45">Mountain</text>
<path d="M -60,30 L 0,-30 L 60,30 z" fill="hsl(60,50%,40%)" /></svg></button>
<div id="sliders">
<button id="button-reset">Reset</button>
<label class="large-label" for="mapName">
Map Name
<input id="input-mapName" class="ParamsValue" name="mapName" type="text" value="mapgen4">
<button id="button-randomMapName" title="Randomize"><i class="fas fa-dice fa-fw"></i></button>
</label>
<label class="large-label" for="descriptiveMapName">
Descriptive Name
<input id="input-descriptiveMapName" class="ParamsValue" name="descriptiveMapName" type="text">
<button id="button-randomMapDescriptive" title="Randomize"><i class="fas fa-dice fa-fw"></i></button>
</label>
</div>
<div id="map"><canvas id="mapgen4" width="2048" height="2048"></canvas></div>
</div>
<div>
<button id="button-download"><i class="fas fa-download fa-fw"></i>Download Map</button>
<button id="button-randomMap" title="Randomize"><i class="fas fa-dice fa-fw"></i>Randomize Map</button>
<button id="button-save" title="Save Map to local storage"><i class="fas fa-save fa-fw"></i>Save</button>
<button id="button-load" title="Load Map from local storage"><i class="fas fa-upload fa-fw"></i>load</button>
</div>
<script defer="defer" src="draggable.v2.js"></script>
<script defer="defer" src="build/_bundle.js"></script>
</div>