nova64 0.2.6 → 0.2.8

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 (53) hide show
  1. package/dist/examples/strider-demo-3d/fix-game.sh +0 -0
  2. package/dist/os9-shell/assets/index-3Hr_q5dj.js +483 -0
  3. package/dist/os9-shell/assets/index-3Hr_q5dj.js.map +1 -0
  4. package/dist/os9-shell/index.html +2 -1
  5. package/dist/runtime/api-2d.js +1158 -0
  6. package/dist/runtime/api-3d/camera.js +73 -0
  7. package/dist/runtime/api-3d/instancing.js +180 -0
  8. package/dist/runtime/api-3d/lights.js +51 -0
  9. package/dist/runtime/api-3d/materials.js +47 -0
  10. package/dist/runtime/api-3d/models.js +84 -0
  11. package/dist/runtime/api-3d/particles.js +296 -0
  12. package/dist/runtime/api-3d/pbr.js +113 -0
  13. package/dist/runtime/api-3d/primitives.js +304 -0
  14. package/dist/runtime/api-3d/scene.js +169 -0
  15. package/dist/runtime/api-3d/transforms.js +161 -0
  16. package/dist/runtime/api-3d.js +166 -0
  17. package/dist/runtime/api-effects.js +840 -0
  18. package/dist/runtime/api-gameutils.js +476 -0
  19. package/dist/runtime/api-generative.js +610 -0
  20. package/dist/runtime/api-presets.js +85 -0
  21. package/dist/runtime/api-skybox.js +232 -0
  22. package/dist/runtime/api-sprites.js +100 -0
  23. package/dist/runtime/api-voxel.js +712 -0
  24. package/dist/runtime/api.js +201 -0
  25. package/dist/runtime/assets.js +27 -0
  26. package/dist/runtime/audio.js +114 -0
  27. package/dist/runtime/collision.js +47 -0
  28. package/dist/runtime/console.js +101 -0
  29. package/dist/runtime/editor.js +233 -0
  30. package/dist/runtime/font.js +233 -0
  31. package/dist/runtime/framebuffer.js +28 -0
  32. package/dist/runtime/fullscreen-button.js +185 -0
  33. package/dist/runtime/gpu-canvas2d.js +47 -0
  34. package/dist/runtime/gpu-threejs.js +643 -0
  35. package/dist/runtime/gpu-webgl2.js +310 -0
  36. package/dist/runtime/index.d.ts +682 -0
  37. package/dist/runtime/index.js +22 -0
  38. package/dist/runtime/input.js +225 -0
  39. package/dist/runtime/logger.js +60 -0
  40. package/dist/runtime/physics.js +101 -0
  41. package/dist/runtime/screens.js +213 -0
  42. package/dist/runtime/storage.js +38 -0
  43. package/dist/runtime/store.js +151 -0
  44. package/dist/runtime/textinput.js +68 -0
  45. package/dist/runtime/ui/buttons.js +124 -0
  46. package/dist/runtime/ui/panels.js +105 -0
  47. package/dist/runtime/ui/text.js +86 -0
  48. package/dist/runtime/ui/widgets.js +141 -0
  49. package/dist/runtime/ui.js +111 -0
  50. package/package.json +34 -32
  51. package/public/os9-shell/assets/index-3Hr_q5dj.js +483 -0
  52. package/public/os9-shell/assets/index-3Hr_q5dj.js.map +1 -0
  53. package/public/os9-shell/index.html +2 -1
@@ -0,0 +1,111 @@
1
+ // 🎨 Nova64 UI System - First Class 2D Interface
2
+ // Thin orchestrator — delegates to runtime/ui/*.js sub-modules
3
+
4
+ import { uiTextModule } from './ui/text.js';
5
+ import { uiPanelsModule } from './ui/panels.js';
6
+ import { uiButtonsModule } from './ui/buttons.js';
7
+ import { uiWidgetsModule } from './ui/widgets.js';
8
+
9
+ export function uiApi(gpu, g) {
10
+ // Shared state objects passed by reference into sub-modules
11
+ const state = { currentFont: 'normal', textAlign: 'left', textBaseline: 'top' };
12
+ const mouse = { x: 0, y: 0, down: false, pressed: false };
13
+ const panels = [];
14
+ const buttons = [];
15
+
16
+ const fonts = {
17
+ tiny: { size: 1, spacing: 1 },
18
+ small: { size: 1, spacing: 2 },
19
+ normal: { size: 2, spacing: 1 },
20
+ large: { size: 3, spacing: 1 },
21
+ huge: { size: 4, spacing: 2 },
22
+ };
23
+
24
+ const rgba8 = g.rgba8;
25
+ const colors = {
26
+ primary: rgba8(0, 120, 255, 255),
27
+ secondary: rgba8(100, 100, 255, 255),
28
+ success: rgba8(0, 255, 100, 255),
29
+ warning: rgba8(255, 200, 0, 255),
30
+ danger: rgba8(255, 50, 50, 255),
31
+ dark: rgba8(20, 20, 30, 255),
32
+ light: rgba8(240, 240, 250, 255),
33
+ white: rgba8(255, 255, 255, 255),
34
+ black: rgba8(0, 0, 0, 255),
35
+ transparent: rgba8(0, 0, 0, 0),
36
+ };
37
+
38
+ const ctx = { g, fonts, state, mouse, colors, panels, buttons };
39
+
40
+ // Init modules — each appends its exports to ctx for later modules to use
41
+ const textMod = uiTextModule(ctx);
42
+ Object.assign(ctx, textMod);
43
+
44
+ const panelMod = uiPanelsModule(ctx);
45
+ Object.assign(ctx, panelMod);
46
+
47
+ const buttonMod = uiButtonsModule(ctx);
48
+ Object.assign(ctx, buttonMod);
49
+
50
+ const widgetMod = uiWidgetsModule(ctx);
51
+ Object.assign(ctx, widgetMod);
52
+
53
+ return {
54
+ // Expose these directly for main.js to wire input before exposeTo is called
55
+ setMousePosition: ctx.setMousePosition,
56
+ setMouseButton: ctx.setMouseButton,
57
+
58
+ exposeTo(target) {
59
+ Object.assign(target, {
60
+ // Font / text system
61
+ setFont: ctx.setFont,
62
+ getFont: ctx.getFont,
63
+ setTextAlign: ctx.setTextAlign,
64
+ setTextBaseline: ctx.setTextBaseline,
65
+ measureText: ctx.measureText,
66
+ drawText: ctx.drawText,
67
+ drawTextShadow: ctx.drawTextShadow,
68
+ drawTextOutline: ctx.drawTextOutline,
69
+
70
+ // Panel system
71
+ createPanel: ctx.createPanel,
72
+ drawPanel: ctx.drawPanel,
73
+ drawAllPanels: ctx.drawAllPanels,
74
+ removePanel: ctx.removePanel,
75
+ clearPanels: ctx.clearPanels,
76
+
77
+ // Button system
78
+ createButton: ctx.createButton,
79
+ updateButton: ctx.updateButton,
80
+ drawButton: ctx.drawButton,
81
+ updateAllButtons: ctx.updateAllButtons,
82
+ drawAllButtons: ctx.drawAllButtons,
83
+ removeButton: ctx.removeButton,
84
+ clearButtons: ctx.clearButtons,
85
+
86
+ // Progress bars (as uiProgressBar to avoid overwriting the api-2d drawProgressBar)
87
+ uiProgressBar: ctx.drawProgressBar,
88
+
89
+ // Advanced shapes
90
+ drawRoundedRect: ctx.drawRoundedRect,
91
+ drawGradientRect: ctx.drawGradientRect,
92
+
93
+ // Layout helpers
94
+ centerX: ctx.centerX,
95
+ centerY: ctx.centerY,
96
+ grid: ctx.grid,
97
+
98
+ // Mouse input
99
+ setMousePosition: ctx.setMousePosition,
100
+ setMouseButton: ctx.setMouseButton,
101
+ getMousePosition: ctx.getMousePosition,
102
+ isMouseDown: ctx.isMouseDown,
103
+ isMousePressed: ctx.isMousePressed,
104
+
105
+ // Color palette and font defs
106
+ uiColors: colors,
107
+ uiFonts: fonts,
108
+ });
109
+ },
110
+ };
111
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nova64",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Nova64 — Ultimate 3D Fantasy Console runtime for JavaScript games powered by Three.js",
5
5
  "keywords": [
6
6
  "fantasy-console",
@@ -46,6 +46,38 @@
46
46
  "README.md",
47
47
  "LICENSE"
48
48
  ],
49
+ "scripts": {
50
+ "dev": "vite",
51
+ "build": "vite build && node scripts/postbuild.js",
52
+ "preview": "vite preview",
53
+ "osBuild": "cd os9-shell && pnpm install && pnpm build && rm -rf ../public/os9-shell/* && mkdir -p ../public/os9-shell && cp -r dist/* ../public/os9-shell/",
54
+ "deployToStarcade9": "bash scripts/deploy-starcade9.sh",
55
+ "serveStarcade9": "npx serve ../starcade9/starcade9.github.io",
56
+ "test": "node tests/test-cli.js",
57
+ "test:api": "node tests/test-cli.js api",
58
+ "test:input": "node tests/test-cli.js input",
59
+ "test:starfox": "node tests/test-cli.js starfox",
60
+ "test:integration": "node tests/test-cli.js integration",
61
+ "test:web": "open tests/test-runner.html || xdg-open tests/test-runner.html || start tests/test-runner.html",
62
+ "test:all": "pnpm run test && pnpm run test:api && pnpm run test:input && pnpm run test:starfox && pnpm run test:integration",
63
+ "test:watch": "nodemon --watch runtime --watch tests --watch examples --exec 'pnpm run test'",
64
+ "bench": "node tests/bench.js",
65
+ "bench:material": "node tests/bench.js --suite=material",
66
+ "bench:instancing": "node tests/bench.js --suite=instancing",
67
+ "bench:mesh": "node tests/bench.js --suite=mesh",
68
+ "lint": "eslint 'runtime/**/*.js' 'src/**/*.js' --max-warnings=0",
69
+ "lint:fix": "eslint 'runtime/**/*.js' 'src/**/*.js' --fix",
70
+ "format": "prettier --write \"**/*.{js,json,md}\"",
71
+ "format:check": "prettier --check \"**/*.{js,json,md}\"",
72
+ "validate": "pnpm run format:check && pnpm run lint && pnpm run test:all",
73
+ "clean": "rm -rf dist node_modules",
74
+ "reinstall": "pnpm run clean && pnpm install",
75
+ "prepare": "husky",
76
+ "prepublishOnly": "pnpm run validate && pnpm run build",
77
+ "release:patch": "pnpm version patch && git push && git push --tags",
78
+ "release:minor": "pnpm version minor && git push && git push --tags",
79
+ "release:major": "pnpm version major && git push && git push --tags"
80
+ },
49
81
  "dependencies": {
50
82
  "three": "^0.182.0",
51
83
  "zustand": "^5.0.11"
@@ -237,35 +269,5 @@
237
269
  "trailingComma": "es5",
238
270
  "printWidth": 100,
239
271
  "arrowParens": "avoid"
240
- },
241
- "scripts": {
242
- "dev": "vite",
243
- "build": "vite build && node scripts/postbuild.js",
244
- "preview": "vite preview",
245
- "osBuild": "cd os9-shell && pnpm install && pnpm build && rm -rf ../public/os9-shell/* && mkdir -p ../public/os9-shell && cp -r dist/* ../public/os9-shell/",
246
- "deployToStarcade9": "bash scripts/deploy-starcade9.sh",
247
- "serveStarcade9": "npx serve ../starcade9/starcade9.github.io",
248
- "test": "node tests/test-cli.js",
249
- "test:api": "node tests/test-cli.js api",
250
- "test:input": "node tests/test-cli.js input",
251
- "test:starfox": "node tests/test-cli.js starfox",
252
- "test:integration": "node tests/test-cli.js integration",
253
- "test:web": "open tests/test-runner.html || xdg-open tests/test-runner.html || start tests/test-runner.html",
254
- "test:all": "pnpm run test && pnpm run test:api && pnpm run test:input && pnpm run test:starfox && pnpm run test:integration",
255
- "test:watch": "nodemon --watch runtime --watch tests --watch examples --exec 'pnpm run test'",
256
- "bench": "node tests/bench.js",
257
- "bench:material": "node tests/bench.js --suite=material",
258
- "bench:instancing": "node tests/bench.js --suite=instancing",
259
- "bench:mesh": "node tests/bench.js --suite=mesh",
260
- "lint": "eslint 'runtime/**/*.js' 'src/**/*.js' --max-warnings=0",
261
- "lint:fix": "eslint 'runtime/**/*.js' 'src/**/*.js' --fix",
262
- "format": "prettier --write \"**/*.{js,json,md}\"",
263
- "format:check": "prettier --check \"**/*.{js,json,md}\"",
264
- "validate": "pnpm run format:check && pnpm run lint && pnpm run test:all",
265
- "clean": "rm -rf dist node_modules",
266
- "reinstall": "pnpm run clean && pnpm install",
267
- "release:patch": "pnpm version patch && git push && git push --tags",
268
- "release:minor": "pnpm version minor && git push && git push --tags",
269
- "release:major": "pnpm version major && git push && git push --tags"
270
272
  }
271
- }
273
+ }