forked from Shando/game_engine_for_esp8266_with_compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index32.html
306 lines (301 loc) · 13.2 KB
/
index32.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<!DOCTYPE html>
<html>
<title>esp32gameEngine</title>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#7CCD7C">
</head>
<body>
<link rel="stylesheet" type="text/css" href="style.css" />
<div id="menu">
<button onclick="onlyAsm();">asm</button>
<button onclick="main();">compile</button>
<button onclick="savebin();">save</button>
<button onclick="spriteEditor.edit()">sprite</button>
<button onclick="listing();">listing</button>
<button onclick="debugVars();">debug</button>
<button onclick="viewSettings();">settings</button>
<button onclick="viewHelp();">help</button>
<select id="lang" onchange="language=this.value">
<option value="eng">ENG</option>
<option value="rus">RUS</option>
</select>
</div>
<div id="container">
<div id="wrap-left">
<div class="header">memory</div>
<textarea id="ram"></textarea>
<div class="header">monitor</div>
<div id="monitor">
<div id="memoryPreviev">
<button onclick="setMemoryPage('m')">-</button>
<input id="memoryPage" value="00" onkeydown="if(event.keyCode==13)setMemoryPage(this.value)">
<button onclick="setMemoryPage('p')">+</button>
<textarea id="areaMemoryPrewiew" disabled="disabled"></textarea>
</div>
<button onclick="cpu.step();document.getElementById('debug').value = cpu.debug();clearTimeout(timerId);">step</button>
<button onclick="timerstart = new Date().getTime();timertime = 0;soundTimer = 0;run();">run</button>
<button onclick="clearTimeout(timerId);document.getElementById('debug').value = cpu.debug();">stop</button>
cpu speed,Hz
<select id="cpuSpeed" name="cpuSpeed" onchange="cpuSpeed=this.value">
<option selected value="8000">500 000</option>
<option value="3200">200 000</option>
<option value="1600">100 000</option>
<option value="800">50 000</option>
<option value="400">25 000</option>
<option value="160">10 000</option>
<option value="80">5 000</option>
<option value="16">1 000</option>
<option value="8">500</option>
<option value="2">100</option>
</select>
<label><input type="checkbox" onclick="rtttl.globalSound = this.checked" id="soundCheckbox" checked>sound</label>
<textarea id="debug" disabled="disabled"></textarea>
</div>
</div>
<div id="wrap-right">
<div class="header">source</div>
<div id="editBlock">
<table id="edit-table">
<tr>
<td style="width:2em;position:relative;">
<div spellcheck="false" disabled id="line-count"></div>
</td><td style="width:100%;position:relative;">
<textArea spellcheck="false" id="input" wrap="off">
void main(){
puts("hello world");
}
</textArea>
</td></tr>
</table>
</div>
<select id="example" name="example">
<option value="0">particle</option>
<option value="1">pi</option>
<option value="2">snake</option>
<option value="3">sprite</option>
<option value="4">maze generate</option>
<option value="5">platform</option>
<option value="6">asteroids</option>
<option value="7">space</option>
<option value="8">flappybird</option>
<option value="9">breackout</option>
<option value="10">mines</option>
<option value="11">dragon</option>
</select>
<button onclick="loadExample();">load example</button>
<a href="gamelist/index.html" target="_blank" id="gamelist">List of games</a>
</div>
</div>
<div class="header">information</div>
<div id="alert"></div>
<br>
<div class="header" style="display:none">console input</div>
<div id="consoleInput" style="display:none" onkeypress="if(event.keyCode == 13)sendToConsole();">
<input id="textForConsole">
<button onclick="sendToConsole();">send</button>
</div>
<div id="div_wind1" class="div_wind">
<div id="drag_wind1" class="div_drag_wind" onmouseover="setup_mouse('div_wind1', 'drag_wind1');">
<div>
listing<div class="close" onclick="closewindow('div_wind1')">X</div>
</div>
</div>
<div class="content_wind">
<div id="disasm"></div>
</div>
</div>
<div id="div_wind2" class="div_wind">
<div id="drag_wind2" class="div_drag_wind" onmouseover="setup_mouse('div_wind2', 'drag_wind2');">
<div>
sprite editor<div class="close" onclick="closewindow('div_wind2')">X</div>
</div>
</div>
<div class="content_wind">
<div id="spriteEditior">
<canvas id="pixelearea" width="32" height="34" ondrop="pAreaOnDrop(event)" ondragover="pAreaAllowDrop(event)"></canvas>
<div id="pixelpanel">
<input name="pixeled" type="radio" value="1" onchange="spriteEditor.setType(0)" checked id="check1"><label for="check1">🖉</label>
<input name="pixeled" type="radio" value="2" onchange="spriteEditor.setType(1)" id="check2"><label for="check2">🌢</label>
</div>
<button onclick="spriteEditor.clear();">cls</button>
<button onclick = "spriteEditor.scroll(0);" style = "width: 1.8em;">→</button>
<button onclick = "spriteEditor.scroll(1);" style = "width: 1.8em;">↑</button>
<button onclick = "spriteEditor.scroll(2);" style = "width: 1.8em;">←</button>
<button onclick = "spriteEditor.scroll(3);" style = "width: 1.8em;">↓</button>
<input type="checkbox" id="check1bit" onclick="spriteEditor.set1bit(this.checked)">
<label for="check1bit" id="check1bitLabel">1 BIT</label>
<input type="checkbox" id="checkRle" onclick="spriteEditor.setRle(this.checked)">
<label for="checkRle" id="checkRleLabel">RLE 100%</label>
<b id="selectColor">[]</b>
<b id="spriteInfo"></b>
<input style="width:5em;" id="r5g6b5HEXinput">
<input type="range" min="0" max="31" step="1" value="1" id="r5g6b5Rinput" onchange="spriteEditor.changePaletteColor()">
<input type="range" min="0" max="63" step="1" value="1" id="r5g6b5Ginput" onchange="spriteEditor.changePaletteColor()">
<input type="range" min="0" max="31" step="1" value="1" id="r5g6b5Binput" onchange="spriteEditor.changePaletteColor()">
<button onclick = "spriteEditor.backColor()" style = "width: 1.8em;">↩</button>
<textarea id="spriteArea" onclick = "spriteEditor.selectAll();">{0,0,0}</textarea>
</div>
</div>
</div>
<div id="div_wind3" class="div_wind">
<div id="drag_wind3" class="div_drag_wind" onmouseover="setup_mouse('div_wind3', 'drag_wind3');">
<div>
debug<div class="close" onclick="closewindow('div_wind3')">X</div>
</div>
</div>
<div class="content_wind">
<div class="bar">
<button onclick="viewDebug('debugVariable')">variable</button>
<button onclick="viewDebug('debugSprite')">sprites</button>
</div>
<textarea id="debugVariable" class="debug" disabled="disabled"></textarea>
<textarea id="debugSprite" class="debug" disabled="disabled"></textarea>
</div>
</div>
<div id="div_wind4" class="div_wind" style="display:none">
<div id="drag_wind4" class="div_drag_wind" onmouseover="setup_mouse('div_wind4', 'drag_wind4');">
<div>
help<div class="close" onclick="closewindow('div_wind4')">X</div>
</div>
</div>
<div class="content_wind">
<a href="https://corax89.github.io/esp8266Game/user_guide/index.html" target="_blank">Click here to open the full guide.</a>
<pre id = "help_hl" style='color:#000020;background:#f6f8ff;margin:0;border: 1px solid #516399;height: 31em;overflow: auto;'>
char putchar(char);
int puts(char[]);
int putn(int);
int printf(char[], arg-list);
int random(int max);
int getchar();
int getkey();
/*key is KEY_UP, KEY_LEFT,
KEY_DOWN, KEY_RIGHT, KEY_A, KEY_B*/
int getpixel(int x, int y);
int spritegetvalue(int n, int type);
/*type is
S_X, S_Y, S_SPEEDX, S_SPEEDY,
S_WIDTH, S_HEIGHT, S_IS_ONEBIT,
S_ANGLE, S_LIVES, S_COLLISION,
S_SOLID, S_GRAVITY, S_ON_COLLISION,
S_ON_EXIT_SCREEN, S_IS_SCROLLED,
S_FLIP_HORIZONTAL*/
int angbetweenspr(int n1, int n2);
int gettimer(int n);
int getspriteinxy(int x,
int y);
int gettileinxy(int x,
int y);
int distance(int x1, int y1, int x2,
int y2);
int savedata(int name, int array,
int count);
int loaddata(int name, int array);
void settimer(int n, int time);
void tone(int freq, int delay);
void loadrtttl(int address, int isLoop);
void playrtttl();
void pausertttl();
void stoprtttl();
void delayredraw();
void clearscreen();
void setpallette(int n, int r5g6b5);
void setcolor(int);
void scroll(int dir);
void putpixel(int x, int y);
void getsprite(int n, int address);
void putsprite(int n, int x, int y);
void spritesetvalue(int n, int type,
int value);
void spritespeed(int n, int speed,
int direction);
void setimagesize(int size);
void gotoxy(int x, int y);
void line(int x, int y, int x1, int y1);
void putimage(int address, int x,
int y, int w, int h);
void putimage1bit(int address, int x,
int y, int w, int h);
void putimagerle(int address, int x,
int y, int w, int h);
*int malloc(int);
void free(*int);
void setparticle(int gravity, int count,
int time);
void setemitter(int time, int dir,
int dir1, int speed);
void drawparticle(int x, int y,
int color);
void loadtile(int adress, int imgwidth,
int imgheight, int width, int height);
void drawtile(int x, int y);
int gettileinxy(int x, int y);
</pre>
</div>
</div>
<div id="div_wind5" class="div_wind">
<div id="drag_wind5" class="div_drag_wind" onmouseover="setup_mouse('div_wind5', 'drag_wind5');">
<div>
settings<div class="close" onclick="closewindow('div_wind5')">X</div>
</div>
</div>
<div class="content_wind">
<div id="settings">
Save format <br>
<input type="radio" id="fileTypeChoice1"
name="filetype" value=".bin" class="checkbox">
<label class="settingslabel" for="fileTypeChoice1">.bin</label>
<input type="radio" id="fileTypeChoice2" checked
name="filetype" value=".lge" class="checkbox">
<label class="settingslabel" for="fileTypeChoice2">.lge</label>
<br><br>
Properties <br>
<label class="settingslabel" for="fileName">Name</label>
<input id="fileName">
<br>
<label class="settingslabel" for="fileAuthor">Author</label>
<input id="fileAuthor">
<br>
<label class="settingslabel" for="fileIco">Image</label>
<input id="fileIco">
<br>
<canvas id="icon" width="24" height="16"></canvas>
<br>
24x16
</div>
<button style="position:absolute;bottom:1em;right:1em;width:3.5em;height:2.5em"
onclick="saveSettings()">ok</button>
</div>
</div>
<!-- SH -->
<div id="div_wind6" class="div_wind">
<div id="drag_wind6" class="div_drag_wind" onmouseover="setup_mouse('div_wind6', 'drag_wind6');">
<div>
Screen
</div>
</div>
<div class="content_wind">
<canvas id="screen1" width="640" height="544"></canvas>
</div>
</div>
<!-- SH -->
<a href="https://github.com/corax89/game_engine_for_esp8266_with_compiler" class="github-corner" aria-label="View source on GitHub">
<svg width="65" height="65" viewBox="0 0 250 250" style="fill:#516399; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
</svg>
</a>
<style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
<script type="text/javascript" src="FileSaver.js"></script>
<script type="text/javascript" src="asm.js"></script>
<script type="text/javascript" src="cpu.js"></script>
<script type="text/javascript" src="spriteEditor.js"></script>
<script type="text/javascript" src="compiler.js"></script>
<script type="text/javascript" src="font.js"></script>
<script type="text/javascript" src="ui.js"></script>
<script type="text/javascript" src="example.js"></script>
<script type="text/javascript" src="sound.js"></script>
</body>
</html>