-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.html
More file actions
322 lines (280 loc) · 9.56 KB
/
shell.html
File metadata and controls
322 lines (280 loc) · 9.56 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
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>cpp-charts Demo</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #e4e4e7;
padding: 20px;
}
.header {
text-align: center;
margin-bottom: 20px;
}
.header h1 {
font-size: 1.5rem;
font-weight: 600;
color: #60a5fa;
margin-bottom: 5px;
}
.header a {
color: #94a3b8;
text-decoration: none;
font-size: 0.9rem;
transition: color 0.2s;
}
.header a:hover {
color: #60a5fa;
}
.canvas-container {
position: relative;
background: #0c0c14;
border-radius: 12px;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
0 0 0 1px rgba(255, 255, 255, 0.05);
overflow: hidden;
}
#canvas {
display: block;
border-radius: 12px;
}
.loading-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 100;
border-radius: 12px;
transition: opacity 0.5s ease-out;
}
.loading-overlay.hidden {
opacity: 0;
pointer-events: none;
}
.spinner {
width: 60px;
height: 60px;
border: 4px solid rgba(96, 165, 250, 0.2);
border-top-color: #60a5fa;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 24px;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.loading-text {
font-size: 1.1rem;
color: #94a3b8;
margin-bottom: 16px;
}
.progress-container {
width: 280px;
height: 6px;
background: rgba(255, 255, 255, 0.1);
border-radius: 3px;
overflow: hidden;
}
.progress-bar {
height: 100%;
background: linear-gradient(90deg, #3b82f6, #60a5fa);
border-radius: 3px;
width: 0%;
transition: width 0.3s ease-out;
}
.progress-text {
font-size: 0.85rem;
color: #64748b;
margin-top: 10px;
}
.controls {
margin-top: 16px;
display: flex;
gap: 12px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 8px;
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 8px;
}
.btn-primary {
background: linear-gradient(135deg, #3b82f6, #2563eb);
color: white;
}
.btn-primary:hover {
background: linear-gradient(135deg, #60a5fa, #3b82f6);
transform: translateY(-1px);
}
.btn-secondary {
background: rgba(255, 255, 255, 0.1);
color: #e4e4e7;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-secondary:hover {
background: rgba(255, 255, 255, 0.15);
}
.footer {
margin-top: 20px;
text-align: center;
color: #64748b;
font-size: 0.8rem;
}
.footer a {
color: #60a5fa;
text-decoration: none;
}
.footer a:hover {
text-decoration: underline;
}
/* Error state */
.error-message {
display: none;
background: rgba(239, 68, 68, 0.1);
border: 1px solid rgba(239, 68, 68, 0.3);
border-radius: 8px;
padding: 16px 24px;
color: #fca5a5;
text-align: center;
margin-top: 20px;
}
.error-message.visible {
display: block;
}
</style>
</head>
<body>
<div class="header">
<h1>📊 cpp-charts</h1>
<a href="index.html">← Back to all demos</a>
</div>
<div class="canvas-container">
<canvas id="canvas" class="emscripten" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
<div class="loading-overlay" id="loading">
<div class="spinner"></div>
<div class="loading-text">Loading demo...</div>
<div class="progress-container">
<div class="progress-bar" id="progressBar"></div>
</div>
<div class="progress-text" id="progressText">Initializing...</div>
</div>
</div>
<div class="controls">
<button class="btn btn-primary" onclick="toggleFullscreen()">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/>
</svg>
Fullscreen
</button>
<button class="btn btn-secondary" onclick="window.location.href='index.html'">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>
<polyline points="9 22 9 12 15 12 15 22"/>
</svg>
All Demos
</button>
</div>
<div class="error-message" id="errorMessage">
Failed to load the demo. Please refresh the page or try a different browser.
</div>
<div class="footer">
Built with <a href="https://www.raylib.com/" target="_blank">raylib</a> and
<a href="https://emscripten.org/" target="_blank">Emscripten</a>
</div>
<script>
var Module = {
canvas: (function() {
var canvas = document.getElementById('canvas');
canvas.width = 1280;
canvas.height = 720;
return canvas;
})(),
setStatus: function(text) {
var progressText = document.getElementById('progressText');
var progressBar = document.getElementById('progressBar');
if (!text) {
// Loading complete
document.getElementById('loading').classList.add('hidden');
return;
}
// Parse progress from text like "Downloading... (50/100)"
var match = text.match(/\((\d+)\/(\d+)\)/);
if (match) {
var current = parseInt(match[1]);
var total = parseInt(match[2]);
var percent = (current / total * 100).toFixed(0);
progressBar.style.width = percent + '%';
progressText.textContent = 'Downloading assets... ' + percent + '%';
} else if (text.indexOf('Downloading') >= 0) {
progressText.textContent = 'Downloading...';
} else if (text.indexOf('Preparing') >= 0 || text.indexOf('Running') >= 0) {
progressBar.style.width = '100%';
progressText.textContent = 'Starting...';
} else {
progressText.textContent = text;
}
},
onRuntimeInitialized: function() {
document.getElementById('loading').classList.add('hidden');
},
onAbort: function(what) {
document.getElementById('loading').classList.add('hidden');
document.getElementById('errorMessage').classList.add('visible');
console.error('Aborted:', what);
}
};
function toggleFullscreen() {
var canvas = document.getElementById('canvas');
if (!document.fullscreenElement) {
if (canvas.requestFullscreen) {
canvas.requestFullscreen();
} else if (canvas.webkitRequestFullscreen) {
canvas.webkitRequestFullscreen();
} else if (canvas.msRequestFullscreen) {
canvas.msRequestFullscreen();
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
}
}
}
// Handle keyboard shortcuts
document.addEventListener('keydown', function(e) {
if (e.key === 'f' || e.key === 'F') {
// Don't capture if canvas has focus (let raylib handle it)
if (document.activeElement !== document.getElementById('canvas')) {
toggleFullscreen();
}
}
});
</script>
{{{ SCRIPT }}}
</body>
</html>