-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathold_custom_shell.html
More file actions
233 lines (223 loc) · 13 KB
/
old_custom_shell.html
File metadata and controls
233 lines (223 loc) · 13 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0">
<title>SkyLockAssault (DEBUG)</title>
<style>
html, body, #canvas {
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
touch-action: none;
background-color: black;
color: white;
}
#canvas {
display: block;
}
#canvas:focus {
outline: none;
}
/* UI Buttons and Slider Styles (invisible but clickable overlays) */
button, input[type="range"], select {
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
opacity: 0; /* Invisible */
pointer-events: none; /* Pass through real mouse events to Godot canvas */
background: transparent;
border: none;
color: transparent; /* No text shown */
font-size: 32px; /* Match size for accurate overlay */
cursor: pointer;
z-index: 10; /* Above canvas for DOM presence, but events pass through */
}
input[type="range"] {
width: 250px; /* Match your Godot slider width */
}
/* Hide options elements initially (still invisible when shown) */
#difficulty-slider, #log-level-select {
display: none;
}
/* Loading UI styles (moved from inline for maintainability) */
#loading {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: black;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 20;
}
#loading img {
max-width: 50%;
max-height: 50%;
}
#progress-bar {
width: 50%;
height: 20px;
background-color: #333;
margin-top: 20px;
border: 1px solid #555;
}
#progress {
width: 0%;
height: 100%;
background-color: #0f0;
}
#status {
color: white;
margin-top: 10px;
}
/* Retry button style (visible override) */
#retry-button {
opacity: 1; /* Visible */
pointer-events: auto; /* Clickable */
color: white; /* Text color */
background-color: #f00; /* Red button for error theme */
border: 1px solid #fff;
padding: 10px 20px;
font-size: 18px;
cursor: pointer;
margin-top: 20px;
display: none; /* Hidden initially */
}
#audio-back-button {
display: none;
top: 80%;
left: 50%;
width: 200px;
height: 50px;
transform: translate(-50%, -50%);
}
/* Add to <style> */
#options-back-button {
display: none;
top: 90%; /* Adjust to match options back button position */
left: 50%;
width: 200px;
height: 50px;
transform: translate(-50%, -50%);
}
</style>
<!-- Removed favicon link to avoid 404 -->
</head>
<body>
<canvas id="canvas" tabindex="0" width="1280" height="720" style="position: absolute; top: 0px; left: 0px; width: 1280px; height: 720px;"></canvas>
<!-- Loading screen with progress bar (updated for better ARIA labeling) -->
<div id="loading">
<img src="$GODOT_SPLASH" alt="Loading...">
<!-- Added aria-labelledby to reference #status, providing a dynamic accessible name like "Loading: X%" for screen readers -->
<div id="progress-bar" role="progressbar" aria-labelledby="status" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
<div id="progress"></div>
</div>
<p id="status" aria-live="polite">Loading...</p>
<button id="retry-button">Retry</button>
</div>
<!-- Main Menu Buttons (invisible overlays) -->
<button id="start-button" style="top: 40%;">START</button>
<button id="options-button" style="top: 50%;">OPTIONS</button>
<button id="quit-button" style="top: 60%;">QUIT</button>
<!-- Audio Menu Elements (invisible overlays) -->
<input id="master-slider" type="range" min="0" max="1" step="0.01" value="1.0" style="top: 30%; width: 200px; display: none;">
<input id="music-slider" type="range" min="0" max="1" step="0.01" value="1.0" style="top: 40%; width: 200px; display: none;">
<input id="sfx-slider" type="range" min="0" max="1" step="0.01" value="1.0" style="top: 50%; width: 200px; display: none;">
<input id="weapon-slider" type="range" min="0" max="1" step="0.01" value="1.0" style="top: 60%; width: 200px; display: none;">
<input id="rotors-slider" type="range" min="0" max="1" step="0.01" value="1.0" style="top: 70%; width: 200px; display: none;">
<input id="mute-master" type="checkbox" checked style="top: 30%; left: 60%; width: 50px; height: 50px; display: none;">
<input id="mute-music" type="checkbox" checked style="top: 40%; left: 60%; width: 50px; height: 50px; display: none;">
<input id="mute-sfx" type="checkbox" checked style="top: 50%; left: 60%; width: 50px; height: 50px; display: none;">
<input id="mute-weapon" type="checkbox" checked style="top: 60%; left: 60%; width: 50px; height: 50px; display: none;">
<input id="mute-rotors" type="checkbox" checked style="top: 70%; left: 60%; width: 50px; height: 50px; display: none;">
<button id="audio-reset-button" style="top: 80%; width: 150px;">Reset</button>
<button id="audio-back-button">Back</button>
<!-- Options Menu Elements (invisible overlays, shown when menu loads) -->
<button id="controls-button" style="top: 21%; left: 50%; transform: translate(-50%, -50%); width: 200px; height: 50px; display: none;">CONTROLS</button>
<button id="audio-button" style="top: 31%; left: 50%; transform: translate(-50%, -50%); width: 200px; height: 50px; display: none;">AUDIO</button>
<button id="advanced-button" style="top: 41%; left: 50%; transform: translate(-50%, -50%); width: 200px; height: 50px; display: none;">ADVANCED</button>
<button id="gameplay-button" style="top: 51%; left: 50%; transform: translate(-50%, -50%); width: 200px; height: 50px; display: none;">GAMEPLAY SETTINGS</button>
<select id="log-level-select" style="top: 55%;">
<option>DEBUG</option>
<option>INFO</option>
<option>WARNING</option>
<option>ERROR</option>
<option>NONE</option>
</select>
<input id="difficulty-slider" type="range" min="0.5" max="2.0" step="0.1" value="1.0" style="top: 45%;">
<button id="options-back-button">Back</button>
<button id="controls-back-button">Back</button>
<button id="advanced-back-button" style="display: none; top: 80%; left: 25%; width: 200px; height: 50px; transform: translate(-50%, -50%);">Back</button>
<button id="advanced-reset-button" style="display: none; top: 80%; left: 75%; width: 200px; height: 50px; transform: translate(-50%, -50%);">Reset</button>
<button id="gameplay-back-button" style="display: none; top: 80%; left: 25%; width: 200px; height: 50px; transform: translate(-50%, -50%);">Back</button>
<button id="gameplay-reset-button" style="display: none; top: 80%; left: 75%; width: 200px; height: 50px; transform: translate(-50%, -50%);">Reset</button>
<script src="$GODOT_URL"></script> <!-- Godot replaces with actual JS file, e.g., tmp_js_export.js -->
<script>
var engine = new Engine($GODOT_CONFIG); // Official placeholder for config
// Start Godot engine (async for stability)
engine.startGame({
onProgress: function(current, total) {
var percentage = total > 0 ? Math.round((current / total) * 100) : 0;
document.getElementById('progress').style.width = percentage + '%';
document.getElementById('progress-bar').setAttribute('aria-valuenow', percentage);
document.getElementById('status').innerText = 'Loading: ' + percentage + '%';
}
}).then(() => {
console.log("Godot engine started successfully!");
// Hide the loading UI and set aria-hidden to prevent screen readers from announcing stale content
var loadingDiv = document.getElementById('loading');
loadingDiv.style.display = 'none';
loadingDiv.setAttribute('aria-hidden', 'true');
window.godotInitialized = true; // Signal for Playwright waits
}).catch(err => {
console.error("Error starting Godot:", err);
// Update UI to persistent error state with retry
document.getElementById('status').innerText = 'Error loading game: ' + (err.message || 'Unknown error. Please try again or refresh the page.');
document.getElementById('progress').style.backgroundColor = 'red'; // Visual failure indicator
document.getElementById('progress-bar').setAttribute('aria-valuenow', '0'); // Reset ARIA for error state
document.getElementById('progress-bar').style.display = 'none'; // Hide progress bar on error
document.getElementById('retry-button').style.display = 'block'; // Show retry button
// window.godotInitialized remains false implicitly
// No aria-hidden here since error state should remain visible/accessible for recovery
});
// Retry button handler (reloads page to reset everything)
document.getElementById('retry-button').onclick = () => {
location.reload();
};
// Hook buttons/sliders to exposed Godot functions
document.getElementById('controls-button').onclick = () => window.controlsPressed([]);
document.getElementById('audio-button').onclick = () => window.audioPressed([]);
document.getElementById('start-button').onclick = () => window.startPressed([]);
document.getElementById('options-button').onclick = () => window.optionsPressed([]);
document.getElementById('gameplay-button').onclick = () => window.gameplayPressed([]);
document.getElementById('advanced-button').onclick = () => window.advancedPressed([]);
document.getElementById('quit-button').onclick = () => window.quitPressed([]);
document.getElementById('difficulty-slider').onchange = (e) => window.changeDifficulty([parseFloat(e.target.value)]);
document.getElementById('log-level-select').onchange = (e) => window.changeLogLevel([e.target.selectedIndex]);
document.getElementById('master-slider').onchange = (e) => window.changeMasterVolume([parseFloat(e.target.value)]);
document.getElementById('music-slider').onchange = (e) => window.changeMusicVolume([parseFloat(e.target.value)]);
document.getElementById('sfx-slider').onchange = (e) => window.changeSfxVolume([parseFloat(e.target.value)]);
document.getElementById('weapon-slider').onchange = (e) => window.changeWeaponVolume([parseFloat(e.target.value)]);
document.getElementById('rotors-slider').onchange = (e) => window.changeRotorsVolume([parseFloat(e.target.value)]);
document.getElementById('mute-master').onchange = (e) => window.toggleMuteMaster([e.target.checked]);
document.getElementById('mute-music').onchange = (e) => window.toggleMuteMusic([e.target.checked]);
document.getElementById('mute-sfx').onchange = (e) => window.toggleMuteSfx([e.target.checked]);
document.getElementById('mute-weapon').onchange = (e) => window.toggleMuteWeapon([e.target.checked]);
document.getElementById('mute-rotors').onchange = (e) => window.toggleMuteRotors([e.target.checked]);
document.getElementById('options-back-button').onclick = () => window.optionsBackPressed([]); // Add this for options back
document.getElementById('controls-back-button').onclick = () => window.controlsBackPressed([]); // Add this for controls back
document.getElementById('audio-back-button').onclick = () => window.audioBackPressed([]); // Add this for audio back
document.getElementById('audio-reset-button').onclick = () => window.audioResetPressed([]); // Add for reset
document.getElementById('advanced-back-button').onclick = () => window.advancedBackPressed([]); // Add this for advanced back
document.getElementById('advanced-reset-button').onclick = () => window.advancedResetPressed([]); // Add for reset
document.getElementById('gameplay-back-button').onclick = () => window.gameplayBackPressed([]); // Add this for advanced back
document.getElementById('gameplay-reset-button').onclick = () => window.gameplayResetPressed([]); // Add for reset
</script>
<div class="ime" contenteditable="true" style="background: none; opacity: 0; position: fixed; text-align: left; font-size: 1px; left: 0px; top: 0px; width: 100%; height: 40px; pointer-events: none; display: none;"></div>
</body>
</html>