nova64 0.2.4 → 0.2.6

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.
Files changed (140) hide show
  1. package/README.md +25 -8
  2. package/bin/nova64.js +165 -0
  3. package/dist/assets/console-CY_kygm3.js +14 -0
  4. package/dist/assets/console-CY_kygm3.js.map +1 -0
  5. package/dist/assets/main-l0sNRNKZ.js.map +1 -0
  6. package/dist/assets/sky/studio/nx.png +0 -0
  7. package/dist/assets/sky/studio/ny.png +0 -0
  8. package/dist/assets/sky/studio/nz.png +0 -0
  9. package/dist/assets/sky/studio/px.png +0 -0
  10. package/dist/assets/sky/studio/py.png +0 -0
  11. package/dist/assets/sky/studio/pz.png +0 -0
  12. package/dist/assets/vanilla-Dcuy32gi.js +2 -0
  13. package/dist/assets/vanilla-Dcuy32gi.js.map +1 -0
  14. package/dist/console.html +899 -0
  15. package/dist/docs/BENCHMARK.md +77 -0
  16. package/dist/docs/CHEATSHEET.md +255 -0
  17. package/dist/docs/EFFECTS_API_GUIDE.md +577 -0
  18. package/dist/docs/EFFECTS_QUICK_REFERENCE.md +331 -0
  19. package/dist/docs/FONT_CHARACTER_REFERENCE.md +219 -0
  20. package/dist/docs/FREE_GLB_ASSETS.md +330 -0
  21. package/dist/docs/FULLSCREEN_BUTTON_FEATURE.md +296 -0
  22. package/dist/docs/GAMEPAD_SUPPORT.md +348 -0
  23. package/dist/docs/GAME_IMPROVEMENTS.md +278 -0
  24. package/dist/docs/GAME_QUALITY_STATUS.md +300 -0
  25. package/dist/docs/MIGRATION_GUIDE.md +553 -0
  26. package/dist/docs/NOVA64_3D_API.md +356 -0
  27. package/dist/docs/NOVA64_API_REFERENCE.md +1406 -0
  28. package/dist/docs/NOVA64_UI_API.md +503 -0
  29. package/dist/docs/UI_SYSTEM_SUMMARY.md +445 -0
  30. package/dist/docs/VOXEL_ENGINE_GUIDE.md +662 -0
  31. package/dist/docs/VOXEL_QUICK_REFERENCE.md +386 -0
  32. package/dist/docs/api-3d.html +750 -0
  33. package/dist/docs/api-effects.html +385 -0
  34. package/dist/docs/api-improvements.md +121 -0
  35. package/dist/docs/api-skybox.html +407 -0
  36. package/dist/docs/api-sprites.html +321 -0
  37. package/dist/docs/api-voxel.html +337 -0
  38. package/dist/docs/api.html +543 -0
  39. package/dist/docs/assets.html +306 -0
  40. package/dist/docs/audio.html +340 -0
  41. package/dist/docs/blogs.html +286 -0
  42. package/dist/docs/collision.html +316 -0
  43. package/dist/docs/console.html +247 -0
  44. package/dist/docs/editor.html +297 -0
  45. package/dist/docs/font.html +247 -0
  46. package/dist/docs/framebuffer.html +247 -0
  47. package/dist/docs/fullscreen-button.html +297 -0
  48. package/dist/docs/gpu-systems.html +247 -0
  49. package/dist/docs/index.html +580 -0
  50. package/dist/docs/input.html +491 -0
  51. package/dist/docs/physics.html +311 -0
  52. package/dist/docs/screens.html +311 -0
  53. package/dist/docs/storage.html +311 -0
  54. package/dist/docs/textinput.html +332 -0
  55. package/dist/docs/ui.html +488 -0
  56. package/dist/examples/3d-advanced/code.js +695 -0
  57. package/dist/examples/adventure-comic-3d/code.js +342 -0
  58. package/dist/examples/audio-lab/code.js +150 -0
  59. package/dist/examples/boids-flocking/code.js +270 -0
  60. package/dist/examples/crystal-cathedral-3d/code.js +706 -0
  61. package/dist/examples/cyberpunk-city-3d/code.js +1383 -0
  62. package/dist/examples/demoscene/README.md +192 -0
  63. package/dist/examples/demoscene/code.js +1081 -0
  64. package/dist/examples/demoscene/meta.json +21 -0
  65. package/dist/examples/dungeon-crawler-3d/code.js +1117 -0
  66. package/dist/examples/f-zero-nova-3d/code.js +865 -0
  67. package/dist/examples/f-zero-nova-3d/code_old.js +1555 -0
  68. package/dist/examples/fps-demo-3d/code.js +744 -0
  69. package/dist/examples/game-of-life-3d/code.js +338 -0
  70. package/dist/examples/generative-art/code.js +632 -0
  71. package/dist/examples/hello-3d/code.js +325 -0
  72. package/dist/examples/hello-skybox/code.js +183 -0
  73. package/dist/examples/hello-world/code.js +19 -0
  74. package/dist/examples/input-showcase/code.js +109 -0
  75. package/dist/examples/instancing-demo/code.js +315 -0
  76. package/dist/examples/minecraft-demo/code.js +387 -0
  77. package/dist/examples/model-viewer-3d/code.js +114 -0
  78. package/dist/examples/mystical-realm-3d/code.js +1203 -0
  79. package/dist/examples/nature-explorer-3d/code.js +1318 -0
  80. package/dist/examples/particles-demo/code.js +522 -0
  81. package/dist/examples/pbr-showcase/code.js +140 -0
  82. package/dist/examples/physics-demo-3d/code.js +948 -0
  83. package/dist/examples/screen-demo/code.js +267 -0
  84. package/dist/examples/shooter-demo-3d/code.js +1286 -0
  85. package/dist/examples/space-combat-3d/IMPLEMENTATION_SUMMARY.md +109 -0
  86. package/dist/examples/space-combat-3d/README.md +135 -0
  87. package/dist/examples/space-combat-3d/code.js +1332 -0
  88. package/dist/examples/space-harrier-3d/code.js +923 -0
  89. package/dist/examples/star-fox-nova-3d/code.js +1116 -0
  90. package/dist/examples/star-fox-nova-3d/code_backup.js +410 -0
  91. package/dist/examples/star-fox-nova-3d/code_broken.js +1821 -0
  92. package/dist/examples/storage-quest/code.js +209 -0
  93. package/dist/examples/strider-demo-3d/IMPROVEMENT_OPTIONS.md +285 -0
  94. package/dist/examples/strider-demo-3d/cache-test.html +132 -0
  95. package/dist/examples/strider-demo-3d/code-fixed.js +582 -0
  96. package/dist/examples/strider-demo-3d/code-old.js +1537 -0
  97. package/dist/examples/strider-demo-3d/code.js +1462 -0
  98. package/dist/examples/strider-demo-3d/code.js.bak2 +1169 -0
  99. package/dist/examples/strider-demo-3d/fix-game.sh +53 -0
  100. package/dist/examples/super-plumber-64/README.md +128 -0
  101. package/dist/examples/super-plumber-64/code.js +1185 -0
  102. package/dist/examples/super-plumber-64/index.html +88 -0
  103. package/dist/examples/test-2d-overlay/code.js +32 -0
  104. package/dist/examples/test-font/code.js +51 -0
  105. package/dist/examples/test-minimal/code.js +21 -0
  106. package/dist/examples/ui-demo/code.js +306 -0
  107. package/dist/examples/wing-commander-space/README.md +180 -0
  108. package/dist/examples/wing-commander-space/code.js +1285 -0
  109. package/dist/examples/wizardry-3d/CHANGELOG.md +366 -0
  110. package/dist/examples/wizardry-3d/code.js +3928 -0
  111. package/dist/index.html +666 -0
  112. package/dist/os9-shell/assets/index-DIHfrTaW.css +1 -0
  113. package/dist/os9-shell/assets/index-KchE_ngx.js +483 -0
  114. package/dist/os9-shell/assets/index-KchE_ngx.js.map +1 -0
  115. package/dist/os9-shell/index.html +23 -0
  116. package/dist/os9-shell/nova-icon.svg +12 -0
  117. package/index.html +6 -1
  118. package/package.json +37 -32
  119. package/public/assets/sky/studio/nx.png +0 -0
  120. package/public/assets/sky/studio/ny.png +0 -0
  121. package/public/assets/sky/studio/nz.png +0 -0
  122. package/public/assets/sky/studio/px.png +0 -0
  123. package/public/assets/sky/studio/py.png +0 -0
  124. package/public/assets/sky/studio/pz.png +0 -0
  125. package/public/os9-shell/assets/index-KchE_ngx.js +483 -0
  126. package/public/os9-shell/assets/index-KchE_ngx.js.map +1 -0
  127. package/public/os9-shell/index.html +10 -1
  128. package/runtime/api-2d.js +301 -21
  129. package/runtime/api-3d/pbr.js +45 -1
  130. package/runtime/api-3d.js +1 -0
  131. package/runtime/api-effects.js +90 -3
  132. package/runtime/api-gameutils.js +476 -0
  133. package/runtime/api-generative.js +610 -0
  134. package/runtime/api-skybox.js +54 -0
  135. package/runtime/api-voxel.js +139 -28
  136. package/runtime/gpu-threejs.js +13 -9
  137. package/runtime/ui.js +2 -2
  138. package/src/main.js +24 -1
  139. package/public/os9-shell/assets/index-B1Uvacma.js +0 -32825
  140. 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
+ }