@bornengine/engine 0.4.16 → 0.5.0

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 (62) hide show
  1. package/README.md +24 -14
  2. package/native/android/Cargo.lock +577 -28
  3. package/native/android/Cargo.toml +2 -0
  4. package/native/android/src/lib.rs +39 -3
  5. package/native/ios/Cargo.lock +573 -24
  6. package/native/ios/Cargo.toml +2 -0
  7. package/native/ios/src/lib.rs +72 -9
  8. package/native/ios/src/text_input.rs +48 -0
  9. package/native/linux/Cargo.lock +623 -35
  10. package/native/linux/Cargo.toml +3 -0
  11. package/native/macos/Cargo.lock +630 -35
  12. package/native/macos/Cargo.toml +3 -0
  13. package/native/shared/Cargo.lock +430 -27
  14. package/native/shared/Cargo.toml +5 -0
  15. package/native/shared/build.rs +41 -1
  16. package/native/shared/src/engine.rs +54 -2
  17. package/native/shared/src/ffi.rs +54 -1
  18. package/native/shared/src/ffi_core/mod.rs +2 -0
  19. package/native/shared/src/ffi_core/ui.rs +182 -0
  20. package/native/shared/src/input.rs +317 -12
  21. package/native/shared/src/lib.rs +1 -0
  22. package/native/shared/src/renderer/mod.rs +47 -201
  23. package/native/shared/src/renderer/texture_store.rs +5 -0
  24. package/native/shared/src/renderer/ui_pass.rs +742 -0
  25. package/native/shared/src/textures.rs +2 -0
  26. package/native/shared/src/ui/commands.rs +213 -0
  27. package/native/shared/src/ui/egui.rs +1282 -0
  28. package/native/shared/src/ui/imgui.rs +1056 -0
  29. package/native/shared/src/ui/input.rs +173 -0
  30. package/native/shared/src/ui/mod.rs +252 -0
  31. package/native/shared/src/ui/responses.rs +61 -0
  32. package/native/tvos/Cargo.lock +576 -27
  33. package/native/tvos/Cargo.toml +2 -0
  34. package/native/visionos/Cargo.lock +571 -22
  35. package/native/visionos/Cargo.toml +2 -0
  36. package/native/watchos/src/ffi_stubs.rs +27 -0
  37. package/native/web/Cargo.lock +346 -11
  38. package/native/web/Cargo.toml +6 -0
  39. package/native/web/bloom_glue.js +84 -11
  40. package/native/web/build.sh +150 -34
  41. package/native/web/src/lib.rs +2 -0
  42. package/native/web/src/ui_ffi.rs +148 -0
  43. package/native/windows/Cargo.lock +638 -38
  44. package/native/windows/Cargo.toml +3 -0
  45. package/native/windows/src/lib.rs +50 -1
  46. package/native/windows/src/windows_text.rs +69 -0
  47. package/package.json +91 -2
  48. package/src/debug-ui/index.ts +4 -0
  49. package/src/debug-ui/types.ts +1 -0
  50. package/src/game/adapters/audio-source-component.ts +67 -0
  51. package/src/game/adapters/rigid-body-component.ts +69 -0
  52. package/src/game/adapters/scene-node-component.ts +49 -0
  53. package/src/game/game-component.ts +89 -0
  54. package/src/game/game-object.ts +338 -0
  55. package/src/game/game-scene.ts +303 -0
  56. package/src/game/index.ts +7 -0
  57. package/src/game/transform.ts +315 -0
  58. package/src/index.ts +27 -0
  59. package/src/ui/api.ts +216 -0
  60. package/src/ui/index.ts +5 -0
  61. package/src/ui/opcodes.ts +66 -0
  62. package/src/ui/types.ts +82 -0
@@ -0,0 +1,82 @@
1
+ import type { Color, Texture } from '../core/types';
2
+
3
+ export type UiId = number;
4
+
5
+ export interface UiResponse {
6
+ /** Whether this ID produced a response in the last completed UI frame. */
7
+ present: boolean;
8
+ clicked: boolean;
9
+ changed: boolean;
10
+ hovered: boolean;
11
+ focused: boolean;
12
+ dragged: boolean;
13
+ value: number;
14
+ text: string;
15
+ }
16
+
17
+ export interface UiApi {
18
+ beginWindow(id: UiId, title: string, x?: number, y?: number, width?: number, height?: number): void;
19
+ endWindow(id?: UiId): void;
20
+ setWindowPosition(id: UiId, x: number, y: number): void;
21
+ setWindowSize(id: UiId, width: number, height: number): void;
22
+ beginPanel(id: UiId): void;
23
+ endPanel(id?: UiId): void;
24
+ beginHorizontal(id: UiId): void;
25
+ endHorizontal(id?: UiId): void;
26
+ beginVertical(id: UiId): void;
27
+ endVertical(id?: UiId): void;
28
+ spacing(amount?: number): void;
29
+ separator(): void;
30
+ label(id: UiId, text: string): void;
31
+ link(id: UiId, text: string): boolean;
32
+ button(id: UiId, text: string): boolean;
33
+ checkbox(id: UiId, label: string, checked: boolean): boolean;
34
+ radioButton(id: UiId, label: string, selected: boolean): boolean;
35
+ sliderFloat(id: UiId, label: string, value: number, min: number, max: number): number;
36
+ sliderInt(id: UiId, label: string, value: number, min: number, max: number): number;
37
+ dragFloat(id: UiId, prefix: string, value: number, speed?: number, min?: number, max?: number): number;
38
+ textEditSingleline(id: UiId, label: string, value: string): string;
39
+ beginCombo(id: UiId, label: string, selectedText: string): void;
40
+ endCombo(id?: UiId): void;
41
+ selectable(id: UiId, label: string, selected: boolean): boolean;
42
+ beginCollapsingHeader(id: UiId, label: string): boolean;
43
+ endCollapsingHeader(id?: UiId): void;
44
+ beginScrollArea(id: UiId): void;
45
+ endScrollArea(id?: UiId): void;
46
+ beginTabBar(id: UiId): void;
47
+ endTabBar(id?: UiId): void;
48
+ beginTabItem(id: UiId, label: string): boolean;
49
+ endTabItem(id?: UiId): void;
50
+ progressBar(id: UiId, fraction: number, label?: string): void;
51
+ registerTexture(texture: Texture): number;
52
+ image(id: UiId, texture: Texture | number, width?: number, height?: number): void;
53
+ paintLine(id: UiId, x1: number, y1: number, x2: number, y2: number, color: Color, thickness?: number): void;
54
+ paintRect(id: UiId, x: number, y: number, width: number, height: number, color: Color): void;
55
+ paintCircle(id: UiId, x: number, y: number, radius: number, color: Color, thickness?: number): void;
56
+ paintText(id: UiId, text: string, x: number, y: number, size: number, color: Color): void;
57
+ paintPolyline(id: UiId, points: Array<{ x: number; y: number }>, color: Color, thickness?: number): void;
58
+ paintPolygon(id: UiId, points: Array<{ x: number; y: number }>, color: Color, thickness?: number): void;
59
+ setTheme(theme: 'dark' | 'light'): void;
60
+ loadFont(id: UiId, family: string, fontBytes: number[]): void;
61
+ setFont(id: UiId): void;
62
+ beginMenuBar(id: UiId): void;
63
+ endMenuBar(id?: UiId): void;
64
+ beginMenu(id: UiId, label: string): void;
65
+ endMenu(id?: UiId): void;
66
+ menuItem(id: UiId, label: string): boolean;
67
+ beginTreeNode(id: UiId, label: string): boolean;
68
+ endTreeNode(id?: UiId): void;
69
+ beginTable(id: UiId, columns: number): void;
70
+ endTable(id?: UiId): void;
71
+ tableNextRow(): void;
72
+ tableNextColumn(): void;
73
+ demoWindow(id?: UiId): void;
74
+ metricsWindow(id?: UiId): void;
75
+ response(id: UiId): UiResponse;
76
+ isAvailable(): boolean;
77
+ wantsPointerInput(): boolean;
78
+ wantsKeyboardInput(): boolean;
79
+ injectText(text: string): void;
80
+ }
81
+
82
+ export type UiColor = Color;