nova64 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -8
- package/bin/nova64.js +165 -0
- package/dist/assets/console-CY_kygm3.js +14 -0
- package/dist/assets/console-CY_kygm3.js.map +1 -0
- package/dist/assets/main-l0sNRNKZ.js.map +1 -0
- package/dist/assets/sky/studio/nx.png +0 -0
- package/dist/assets/sky/studio/ny.png +0 -0
- package/dist/assets/sky/studio/nz.png +0 -0
- package/dist/assets/sky/studio/px.png +0 -0
- package/dist/assets/sky/studio/py.png +0 -0
- package/dist/assets/sky/studio/pz.png +0 -0
- package/dist/assets/vanilla-Dcuy32gi.js +2 -0
- package/dist/assets/vanilla-Dcuy32gi.js.map +1 -0
- package/dist/console.html +899 -0
- package/dist/docs/BENCHMARK.md +77 -0
- package/dist/docs/CHEATSHEET.md +255 -0
- package/dist/docs/EFFECTS_API_GUIDE.md +577 -0
- package/dist/docs/EFFECTS_QUICK_REFERENCE.md +331 -0
- package/dist/docs/FONT_CHARACTER_REFERENCE.md +219 -0
- package/dist/docs/FREE_GLB_ASSETS.md +330 -0
- package/dist/docs/FULLSCREEN_BUTTON_FEATURE.md +296 -0
- package/dist/docs/GAMEPAD_SUPPORT.md +348 -0
- package/dist/docs/GAME_IMPROVEMENTS.md +278 -0
- package/dist/docs/GAME_QUALITY_STATUS.md +300 -0
- package/dist/docs/MIGRATION_GUIDE.md +553 -0
- package/dist/docs/NOVA64_3D_API.md +356 -0
- package/dist/docs/NOVA64_API_REFERENCE.md +1406 -0
- package/dist/docs/NOVA64_UI_API.md +503 -0
- package/dist/docs/UI_SYSTEM_SUMMARY.md +445 -0
- package/dist/docs/VOXEL_ENGINE_GUIDE.md +662 -0
- package/dist/docs/VOXEL_QUICK_REFERENCE.md +386 -0
- package/dist/docs/api-3d.html +750 -0
- package/dist/docs/api-effects.html +385 -0
- package/dist/docs/api-improvements.md +121 -0
- package/dist/docs/api-skybox.html +407 -0
- package/dist/docs/api-sprites.html +321 -0
- package/dist/docs/api-voxel.html +337 -0
- package/dist/docs/api.html +543 -0
- package/dist/docs/assets.html +306 -0
- package/dist/docs/audio.html +340 -0
- package/dist/docs/blogs.html +286 -0
- package/dist/docs/collision.html +316 -0
- package/dist/docs/console.html +247 -0
- package/dist/docs/editor.html +297 -0
- package/dist/docs/font.html +247 -0
- package/dist/docs/framebuffer.html +247 -0
- package/dist/docs/fullscreen-button.html +297 -0
- package/dist/docs/gpu-systems.html +247 -0
- package/dist/docs/index.html +580 -0
- package/dist/docs/input.html +491 -0
- package/dist/docs/physics.html +311 -0
- package/dist/docs/screens.html +311 -0
- package/dist/docs/storage.html +311 -0
- package/dist/docs/textinput.html +332 -0
- package/dist/docs/ui.html +488 -0
- package/dist/examples/3d-advanced/code.js +695 -0
- package/dist/examples/adventure-comic-3d/code.js +342 -0
- package/dist/examples/audio-lab/code.js +150 -0
- package/dist/examples/boids-flocking/code.js +270 -0
- package/dist/examples/crystal-cathedral-3d/code.js +706 -0
- package/dist/examples/cyberpunk-city-3d/code.js +1383 -0
- package/dist/examples/demoscene/README.md +192 -0
- package/dist/examples/demoscene/code.js +1081 -0
- package/dist/examples/demoscene/meta.json +21 -0
- package/dist/examples/dungeon-crawler-3d/code.js +1117 -0
- package/dist/examples/f-zero-nova-3d/code.js +865 -0
- package/dist/examples/f-zero-nova-3d/code_old.js +1555 -0
- package/dist/examples/fps-demo-3d/code.js +744 -0
- package/dist/examples/game-of-life-3d/code.js +338 -0
- package/dist/examples/generative-art/code.js +632 -0
- package/dist/examples/hello-3d/code.js +325 -0
- package/dist/examples/hello-skybox/code.js +183 -0
- package/dist/examples/hello-world/code.js +19 -0
- package/dist/examples/input-showcase/code.js +109 -0
- package/dist/examples/instancing-demo/code.js +315 -0
- package/dist/examples/minecraft-demo/code.js +387 -0
- package/dist/examples/model-viewer-3d/code.js +114 -0
- package/dist/examples/mystical-realm-3d/code.js +1203 -0
- package/dist/examples/nature-explorer-3d/code.js +1318 -0
- package/dist/examples/particles-demo/code.js +522 -0
- package/dist/examples/pbr-showcase/code.js +140 -0
- package/dist/examples/physics-demo-3d/code.js +948 -0
- package/dist/examples/screen-demo/code.js +267 -0
- package/dist/examples/shooter-demo-3d/code.js +1286 -0
- package/dist/examples/space-combat-3d/IMPLEMENTATION_SUMMARY.md +109 -0
- package/dist/examples/space-combat-3d/README.md +135 -0
- package/dist/examples/space-combat-3d/code.js +1332 -0
- package/dist/examples/space-harrier-3d/code.js +923 -0
- package/dist/examples/star-fox-nova-3d/code.js +1116 -0
- package/dist/examples/star-fox-nova-3d/code_backup.js +410 -0
- package/dist/examples/star-fox-nova-3d/code_broken.js +1821 -0
- package/dist/examples/storage-quest/code.js +209 -0
- package/dist/examples/strider-demo-3d/IMPROVEMENT_OPTIONS.md +285 -0
- package/dist/examples/strider-demo-3d/cache-test.html +132 -0
- package/dist/examples/strider-demo-3d/code-fixed.js +582 -0
- package/dist/examples/strider-demo-3d/code-old.js +1537 -0
- package/dist/examples/strider-demo-3d/code.js +1462 -0
- package/dist/examples/strider-demo-3d/code.js.bak2 +1169 -0
- package/dist/examples/strider-demo-3d/fix-game.sh +53 -0
- package/dist/examples/super-plumber-64/README.md +128 -0
- package/dist/examples/super-plumber-64/code.js +1185 -0
- package/dist/examples/super-plumber-64/index.html +88 -0
- package/dist/examples/test-2d-overlay/code.js +32 -0
- package/dist/examples/test-font/code.js +51 -0
- package/dist/examples/test-minimal/code.js +21 -0
- package/dist/examples/ui-demo/code.js +306 -0
- package/dist/examples/wing-commander-space/README.md +180 -0
- package/dist/examples/wing-commander-space/code.js +1285 -0
- package/dist/examples/wizardry-3d/CHANGELOG.md +366 -0
- package/dist/examples/wizardry-3d/code.js +3928 -0
- package/dist/index.html +666 -0
- package/dist/os9-shell/assets/index-DIHfrTaW.css +1 -0
- package/dist/os9-shell/assets/index-KchE_ngx.js +483 -0
- package/dist/os9-shell/assets/index-KchE_ngx.js.map +1 -0
- package/dist/os9-shell/index.html +23 -0
- package/dist/os9-shell/nova-icon.svg +12 -0
- package/dist/runtime/api-2d.js +1158 -0
- package/dist/runtime/api-3d/camera.js +73 -0
- package/dist/runtime/api-3d/instancing.js +180 -0
- package/dist/runtime/api-3d/lights.js +51 -0
- package/dist/runtime/api-3d/materials.js +47 -0
- package/dist/runtime/api-3d/models.js +84 -0
- package/dist/runtime/api-3d/particles.js +296 -0
- package/dist/runtime/api-3d/pbr.js +113 -0
- package/dist/runtime/api-3d/primitives.js +304 -0
- package/dist/runtime/api-3d/scene.js +169 -0
- package/dist/runtime/api-3d/transforms.js +161 -0
- package/dist/runtime/api-3d.js +166 -0
- package/dist/runtime/api-effects.js +840 -0
- package/dist/runtime/api-gameutils.js +476 -0
- package/dist/runtime/api-generative.js +610 -0
- package/dist/runtime/api-presets.js +85 -0
- package/dist/runtime/api-skybox.js +232 -0
- package/dist/runtime/api-sprites.js +100 -0
- package/dist/runtime/api-voxel.js +712 -0
- package/dist/runtime/api.js +201 -0
- package/dist/runtime/assets.js +27 -0
- package/dist/runtime/audio.js +114 -0
- package/dist/runtime/collision.js +47 -0
- package/dist/runtime/console.js +101 -0
- package/dist/runtime/editor.js +233 -0
- package/dist/runtime/font.js +233 -0
- package/dist/runtime/framebuffer.js +28 -0
- package/dist/runtime/fullscreen-button.js +185 -0
- package/dist/runtime/gpu-canvas2d.js +47 -0
- package/dist/runtime/gpu-threejs.js +643 -0
- package/dist/runtime/gpu-webgl2.js +310 -0
- package/dist/runtime/index.d.ts +682 -0
- package/dist/runtime/index.js +22 -0
- package/dist/runtime/input.js +225 -0
- package/dist/runtime/logger.js +60 -0
- package/dist/runtime/physics.js +101 -0
- package/dist/runtime/screens.js +213 -0
- package/dist/runtime/storage.js +38 -0
- package/dist/runtime/store.js +151 -0
- package/dist/runtime/textinput.js +68 -0
- package/dist/runtime/ui/buttons.js +124 -0
- package/dist/runtime/ui/panels.js +105 -0
- package/dist/runtime/ui/text.js +86 -0
- package/dist/runtime/ui/widgets.js +141 -0
- package/dist/runtime/ui.js +111 -0
- package/index.html +6 -1
- package/package.json +9 -2
- package/public/assets/sky/studio/nx.png +0 -0
- package/public/assets/sky/studio/ny.png +0 -0
- package/public/assets/sky/studio/nz.png +0 -0
- package/public/assets/sky/studio/px.png +0 -0
- package/public/assets/sky/studio/py.png +0 -0
- package/public/assets/sky/studio/pz.png +0 -0
- package/public/os9-shell/assets/index-KchE_ngx.js +483 -0
- package/public/os9-shell/assets/index-KchE_ngx.js.map +1 -0
- package/public/os9-shell/index.html +10 -1
- package/runtime/api-2d.js +301 -21
- package/runtime/api-3d/pbr.js +45 -1
- package/runtime/api-3d.js +1 -0
- package/runtime/api-effects.js +90 -3
- package/runtime/api-gameutils.js +476 -0
- package/runtime/api-generative.js +610 -0
- package/runtime/api-skybox.js +54 -0
- package/runtime/api-voxel.js +139 -28
- package/runtime/gpu-threejs.js +13 -9
- package/runtime/ui.js +2 -2
- package/src/main.js +20 -0
- package/public/os9-shell/assets/index-B1Uvacma.js +0 -32825
- package/public/os9-shell/assets/index-B1Uvacma.js.map +0 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// Nova64 Screen Management System Demo
|
|
2
|
+
// Demonstrates the new screen management API for creating multi-screen games
|
|
3
|
+
|
|
4
|
+
export async function init() {
|
|
5
|
+
console.log('🖥️ Nova64 Screen Management Demo');
|
|
6
|
+
|
|
7
|
+
// Setup 3D scene
|
|
8
|
+
cls();
|
|
9
|
+
setCameraPosition(0, 5, 10);
|
|
10
|
+
setCameraTarget(0, 0, 0);
|
|
11
|
+
setCameraFOV(60);
|
|
12
|
+
|
|
13
|
+
// Set background fog
|
|
14
|
+
setFog(0x001122, 20, 100);
|
|
15
|
+
|
|
16
|
+
// Register Menu Screen
|
|
17
|
+
addScreen('menu', {
|
|
18
|
+
enter() {
|
|
19
|
+
console.log('📋 Menu Screen Active');
|
|
20
|
+
this.selectedOption = 0;
|
|
21
|
+
this.options = ['Start Game', 'Settings', 'Credits', 'Quit'];
|
|
22
|
+
this.animTime = 0;
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
update(dt) {
|
|
26
|
+
this.animTime += dt;
|
|
27
|
+
|
|
28
|
+
if ((isKeyPressed('w') || isKeyPressed('ArrowUp')) && this.selectedOption > 0) {
|
|
29
|
+
this.selectedOption--;
|
|
30
|
+
}
|
|
31
|
+
if (
|
|
32
|
+
(isKeyPressed('s') || isKeyPressed('ArrowDown')) &&
|
|
33
|
+
this.selectedOption < this.options.length - 1
|
|
34
|
+
) {
|
|
35
|
+
this.selectedOption++;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (isKeyPressed(' ') || isKeyPressed('Enter')) {
|
|
39
|
+
switch (this.selectedOption) {
|
|
40
|
+
case 0:
|
|
41
|
+
switchToScreen('game', { level: 1 });
|
|
42
|
+
break;
|
|
43
|
+
case 1:
|
|
44
|
+
switchToScreen('settings');
|
|
45
|
+
break;
|
|
46
|
+
case 2:
|
|
47
|
+
switchToScreen('credits');
|
|
48
|
+
break;
|
|
49
|
+
case 3:
|
|
50
|
+
console.log('Quit selected');
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
draw() {
|
|
57
|
+
const cx = 160;
|
|
58
|
+
|
|
59
|
+
// Dark gradient background
|
|
60
|
+
drawGradient(0, 0, 320, 240, rgba8(5, 5, 22, 255), rgba8(16, 8, 42, 255), 'v');
|
|
61
|
+
|
|
62
|
+
// Radial spotlight behind title
|
|
63
|
+
drawRadialGradient(cx, 42, 80, rgba8(0, 180, 120, 35), rgba8(0, 0, 0, 0));
|
|
64
|
+
|
|
65
|
+
// Title with glow
|
|
66
|
+
const titleY = 24 + Math.sin(this.animTime * 2) * 3;
|
|
67
|
+
drawGlowTextCentered('NOVA64', cx, titleY, rgba8(100, 255, 200, 255), rgba8(0, 100, 80, 140));
|
|
68
|
+
|
|
69
|
+
// Pixel-bordered option box
|
|
70
|
+
const boxY = 68;
|
|
71
|
+
const boxH = this.options.length * 25 + 18;
|
|
72
|
+
drawPixelBorder(28, boxY, 264, boxH, rgba8(70, 150, 255, 180), rgba8(18, 45, 110, 180), 2);
|
|
73
|
+
|
|
74
|
+
// Menu options
|
|
75
|
+
this.options.forEach((option, i) => {
|
|
76
|
+
const y = 78 + i * 25;
|
|
77
|
+
const selected = i === this.selectedOption;
|
|
78
|
+
|
|
79
|
+
if (selected) {
|
|
80
|
+
// Highlight bar
|
|
81
|
+
drawGradient(30, y - 3, 260, 22, rgba8(50, 110, 255, 130), rgba8(25, 55, 190, 80), 'v');
|
|
82
|
+
drawGlowTextCentered(
|
|
83
|
+
'> ' + option + ' <',
|
|
84
|
+
cx,
|
|
85
|
+
y,
|
|
86
|
+
rgba8(255, 255, 80, 255),
|
|
87
|
+
rgba8(120, 100, 0, 90)
|
|
88
|
+
);
|
|
89
|
+
} else {
|
|
90
|
+
printCentered(option, cx, y, rgba8(175, 180, 205, 255));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
printCentered('W/S/↑↓ Navigate Space/Enter Select', cx, 192, rgba8(110, 115, 135, 255));
|
|
95
|
+
|
|
96
|
+
// CRT scanlines overlay
|
|
97
|
+
drawScanlines(48, 2);
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Register Game Screen
|
|
102
|
+
addScreen('game', {
|
|
103
|
+
enter(data) {
|
|
104
|
+
console.log('🎮 Game Screen Active');
|
|
105
|
+
this.level = data.level || 1;
|
|
106
|
+
this.score = 0;
|
|
107
|
+
this.time = 0;
|
|
108
|
+
this.cube = createCube(2, 0x44aaff, [0, 0, 0]);
|
|
109
|
+
this.rotation = 0;
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
update(dt) {
|
|
113
|
+
this.time += dt;
|
|
114
|
+
this.rotation += dt;
|
|
115
|
+
this.score += Math.floor(dt * 10);
|
|
116
|
+
|
|
117
|
+
setRotation(this.cube, this.rotation, this.rotation * 0.7, 0);
|
|
118
|
+
setPosition(this.cube, Math.sin(this.time) * 3, 0, 0);
|
|
119
|
+
|
|
120
|
+
if (isKeyPressed('m')) {
|
|
121
|
+
switchToScreen('menu');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (this.time > 15) {
|
|
125
|
+
switchToScreen('gameOver', {
|
|
126
|
+
score: this.score,
|
|
127
|
+
level: this.level,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
draw() {
|
|
133
|
+
print(`Level: ${this.level}`, 10, 10, rgba8(255, 255, 255));
|
|
134
|
+
print(`Score: ${this.score}`, 10, 30, rgba8(255, 255, 255));
|
|
135
|
+
print(`Time: ${Math.floor(this.time)}s`, 10, 50, rgba8(255, 255, 255));
|
|
136
|
+
print('Press M for Menu', 200, 10, rgba8(200, 200, 200));
|
|
137
|
+
|
|
138
|
+
// Crosshair
|
|
139
|
+
const centerX = 160,
|
|
140
|
+
centerY = 90;
|
|
141
|
+
line(centerX - 8, centerY, centerX + 8, centerY, 0xffffff);
|
|
142
|
+
line(centerX, centerY - 8, centerX, centerY + 8, 0xffffff);
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
exit() {
|
|
146
|
+
if (this.cube) destroyMesh(this.cube);
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// Register Settings Screen
|
|
151
|
+
addScreen('settings', {
|
|
152
|
+
enter() {
|
|
153
|
+
console.log('⚙️ Settings Screen Active');
|
|
154
|
+
this.volume = 75;
|
|
155
|
+
this.difficulty = 'Normal';
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
update(dt) {
|
|
159
|
+
if (isKeyPressed('a')) this.volume = Math.max(0, this.volume - 5);
|
|
160
|
+
if (isKeyPressed('d')) this.volume = Math.min(100, this.volume + 5);
|
|
161
|
+
|
|
162
|
+
if (isKeyPressed('m')) {
|
|
163
|
+
switchToScreen('menu');
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
draw() {
|
|
168
|
+
const centerX = 160;
|
|
169
|
+
|
|
170
|
+
print('SETTINGS', centerX - 30, 50, rgba8(255, 255, 100));
|
|
171
|
+
print(`Volume: ${this.volume}%`, centerX - 40, 100, rgba8(255, 255, 255));
|
|
172
|
+
print('A/D to adjust volume', centerX - 50, 120, rgba8(150, 150, 150));
|
|
173
|
+
print('Press M for Menu', centerX - 40, 160, rgba8(200, 200, 200));
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Register Credits Screen
|
|
178
|
+
addScreen('credits', {
|
|
179
|
+
enter() {
|
|
180
|
+
console.log('📜 Credits Screen Active');
|
|
181
|
+
this.scrollY = 200;
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
update(dt) {
|
|
185
|
+
this.scrollY -= dt * 30;
|
|
186
|
+
|
|
187
|
+
if (this.scrollY < -200) {
|
|
188
|
+
this.scrollY = 200;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (isKeyPressed('m')) {
|
|
192
|
+
switchToScreen('menu');
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
draw() {
|
|
197
|
+
const centerX = 160;
|
|
198
|
+
const credits = [
|
|
199
|
+
'NOVA64 SCREEN SYSTEM',
|
|
200
|
+
'',
|
|
201
|
+
'Programming: GitHub Copilot',
|
|
202
|
+
'Framework: Nova64 v0.2.0',
|
|
203
|
+
'Graphics: Three.js',
|
|
204
|
+
'',
|
|
205
|
+
'Built for retro gaming!',
|
|
206
|
+
];
|
|
207
|
+
|
|
208
|
+
credits.forEach((line, i) => {
|
|
209
|
+
const y = this.scrollY + i * 25;
|
|
210
|
+
if (y > -20 && y < 200) {
|
|
211
|
+
const color = line === '' ? 0 : rgba8(200, 200, 255);
|
|
212
|
+
if (color !== 0) {
|
|
213
|
+
print(line, centerX - line.length * 3, y, color);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
print('Press M for Menu', centerX - 40, 220, rgba8(150, 150, 150));
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// Register Game Over Screen
|
|
223
|
+
addScreen('gameOver', {
|
|
224
|
+
enter(data) {
|
|
225
|
+
console.log('💀 Game Over Screen Active');
|
|
226
|
+
this.data = data;
|
|
227
|
+
this.animTime = 0;
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
update(dt) {
|
|
231
|
+
this.animTime += dt;
|
|
232
|
+
|
|
233
|
+
if (isKeyPressed(' ')) {
|
|
234
|
+
switchToScreen('menu');
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (isKeyPressed('r')) {
|
|
238
|
+
switchToScreen('game', { level: this.data.level });
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
draw() {
|
|
243
|
+
const centerX = 160,
|
|
244
|
+
centerY = 90;
|
|
245
|
+
|
|
246
|
+
const flash = Math.sin(this.animTime * 6) > 0;
|
|
247
|
+
const color = flash ? rgba8(255, 100, 100) : rgba8(200, 50, 50);
|
|
248
|
+
|
|
249
|
+
print('GAME OVER', centerX - 35, centerY - 20, color);
|
|
250
|
+
print(`Score: ${this.data.score}`, centerX - 30, centerY + 10, rgba8(255, 255, 255));
|
|
251
|
+
print('Space = Menu, R = Retry', centerX - 55, centerY + 40, rgba8(200, 200, 200));
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// Start with menu
|
|
256
|
+
startScreens('menu');
|
|
257
|
+
console.log('✅ Screen System Ready!');
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export function update(dt) {
|
|
261
|
+
// Screen manager handles updates automatically
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function draw() {
|
|
265
|
+
cls();
|
|
266
|
+
// Screen manager handles drawing automatically
|
|
267
|
+
}
|