-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
146 lines (132 loc) · 7.15 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
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Sandbox</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body style="background: rgb(236, 240, 241)">
<!-- Create the canvas that the C++ code will draw into -->
<div style = "text-align:center;">
<div style = "display: flex; justify-content: center;">
<fieldset>
<legend>Tool</legend>
<div>
<input type="range" id="toolAmountSlider"
name="toolAmountAmount" min="1" max="10" value="10" step="1"
oninput="toolAmountAmount.value=toolAmountSlider.value; changeToolAmount_cwrap(toolAmountSlider.value)">
<output name="ToolAmountAmount" id="toolAmountAmount" for="toolAmountSlider">10</output>
<label for="toolAmountAmount">Amount</label>
</div>
<div>
<input type="range" id="toolRadiusSlider"
name="toolRadiusSlider" min="5" max="100" value="15" step="1"
oninput="toolRadiusAmount.value=toolRadiusSlider.value; changeToolRadius_cwrap(toolRadiusSlider.value)">
<output name="ToolRadiusAmount" id="toolRadiusAmount" for="toolRadiusSlider">15</output>
<label for="toolRadiusAmount">Radius</label>
</div>
<div class="button" onclick="selectToolStone_cwrap()">
<input type="radio" id="Stone" name="check-substitution-2" />
<label for="Stone">Stone</label>
</div>
<div class="button" onclick="selectToolSand_cwrap()" >
<input type="radio" id="Sand" name="check-substitution-2" />
<label for="Sand">Sand</label>
</div>
<div class="button" onclick="selectToolWater_cwrap()">
<input type="radio" id="Water" name="check-substitution-2" />
<label for="Water">Water</label>
</div>
<div class="button" onclick="selectToolLava_cwrap()">
<input type="radio" id="Lava" name="check-substitution-2" />
<label for="Lava">Lava</label>
</div>
<div class="button" onclick="selectToolMist_cwrap()">
<input type="radio" id="Mist" name="check-substitution-2" />
<label for="Mist">Mist</label>
</div>
<div class="button" onclick="selectToolFoam_cwrap()">
<input type="radio" id="Foam" name="check-substitution-2" />
<label for="Foam">Foam</label>
</div>
</fieldset>
<fieldset>
<legend>Map generation</legend>
<div>
<input type="range" id="mapGenDetailSlider"
name="mapGenDetailSlider" min="0.1" max="1.0" value="1.0" step="0.1"
oninput="mapGenDetailAmount.value=mapGenDetailSlider.value; changeMapGenDetail_cwrap(mapGenDetailSlider.value)">
<output name="mapGenDetailAmount" id="mapGenDetailAmount" for="toolRadiusSlider" style="color:transparent;">9</output>
<label for="mapGenDetailAmount">Detail</label>
</div>
<div>
<input type="range" id="sandHeightSlider"
name="sandHeightSlider" min="0" max="1" value="0.4" step="0.01"
oninput="sandHeightAmount.value=sandHeightSlider.value; changeSandHeight_cwrap(sandHeightSlider.value)">
<output name="sandHeightAmount" id="sandHeightAmount" for="sandHeightSlider" >0.4</output>
<label for="sandHeightAmount">Sand</label>
</div>
<fieldset>
<legend>Coordinates</legend>
<div>
<input type="range" id="mapGenXSlider"
name="mapGenXSlider" min="0" max="1000" value="0" step="1"
oninput="mapGenXAmount.value=mapGenXSlider.value; changemapGenX_cwrap(mapGenXSlider.value)">
<output name="mapGenXlAmount" id="mapGenXAmount" for="mapGenXSlider" >0</output>
<label for="mapGenXAmount">X</label>
</div>
<div>
<input type="range" id="mapGenYSlider"
name="mapGenYSlider" min="0" max="1000" value="0" step="1"
oninput="mapGenYAmount.value=mapGenYSlider.value; changemapGenY_cwrap(mapGenYSlider.value)">
<output name="mapGenYAmount" id="mapGenYAmount" for="mapGenYSlider" >0</output>
<label for="mapGenYAmount">Y</label>
</div>
</fieldset>
<div>
<div >
<button onclick="generateMap_cwrap()">Generate</button>
<input type="checkbox" id="autoGenerateCheckbox" onInput="setAutoGenerate_cwrap(autoGenerateCheckbox.checked)"> Autogenerate
</div>
</div>
</fieldset>
</div>
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
</div>
<div id="loadingDiv">Loading...</div>
<!-- Allow the C++ to access the canvas element -->
<script type='text/javascript'>
//Needed for keyboard to work on itch
window.onload = function () { window.focus(); }
window.onclick = function () { window.focus(); }
var canv = document.getElementById('canvas');
var Module = {
onRuntimeInitialized: function() {
console.log("Emscripten loaded");
var e = document.getElementById('loadingDiv');
e.style.visibility = 'hidden';
},
canvas: canv
};
</script>
<!-- Call the javascript glue code (index.js) as generated by Emscripten -->
<script src="application.js"></script>
<script type='text/javascript'>
selectToolStone_cwrap = Module.cwrap('selectToolStone', 'number', ['number']);
selectToolSand_cwrap = Module.cwrap('selectToolSand', 'number', ['number']);
selectToolWater_cwrap = Module.cwrap('selectToolWater', 'number', ['number']);
selectToolLava_cwrap = Module.cwrap('selectToolLava', 'number', ['number']);
selectToolMist_cwrap = Module.cwrap('selectToolMist', 'number', ['number']);
selectToolFoam_cwrap = Module.cwrap('selectToolFoam', 'number', ['number']);
changeToolAmount_cwrap = Module.cwrap('changeToolAmount', 'number', ['number']);
changeToolRadius_cwrap = Module.cwrap('changeToolRadius', 'number', ['number']);
changeMapGenDetail_cwrap = Module.cwrap('changeMapGenDetail', 'number', ['number']);
changeSandHeight_cwrap = Module.cwrap('changeSandHeight', 'number', ['number']);
generateMap_cwrap = Module.cwrap('generateMap', 'number', ['number']);
setAutoGenerate_cwrap = Module.cwrap('setAutoGenerate', 'number', ['number']);
changemapGenX_cwrap = Module.cwrap('setmapGenX', 'number', ['number']);
changemapGenY_cwrap = Module.cwrap('setmapGenY', 'number', ['number']);
</script>
</body>
</html>