@bornengine/engine 0.4.16 → 0.5.1
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 +24 -14
- package/native/android/Cargo.lock +577 -28
- package/native/android/Cargo.toml +2 -0
- package/native/android/src/lib.rs +39 -3
- package/native/ios/Cargo.lock +573 -24
- package/native/ios/Cargo.toml +2 -0
- package/native/ios/src/lib.rs +72 -9
- package/native/ios/src/text_input.rs +48 -0
- package/native/linux/Cargo.lock +623 -35
- package/native/linux/Cargo.toml +3 -0
- package/native/macos/Cargo.lock +630 -35
- package/native/macos/Cargo.toml +3 -0
- package/native/shared/Cargo.lock +430 -27
- package/native/shared/Cargo.toml +5 -0
- package/native/shared/build.rs +41 -1
- package/native/shared/src/engine.rs +54 -2
- package/native/shared/src/ffi.rs +54 -1
- package/native/shared/src/ffi_core/mod.rs +2 -0
- package/native/shared/src/ffi_core/ui.rs +182 -0
- package/native/shared/src/input.rs +317 -12
- package/native/shared/src/lib.rs +1 -0
- package/native/shared/src/renderer/mod.rs +47 -201
- package/native/shared/src/renderer/texture_store.rs +5 -0
- package/native/shared/src/renderer/ui_pass.rs +742 -0
- package/native/shared/src/textures.rs +2 -0
- package/native/shared/src/ui/commands.rs +213 -0
- package/native/shared/src/ui/egui.rs +1282 -0
- package/native/shared/src/ui/imgui.rs +1056 -0
- package/native/shared/src/ui/input.rs +173 -0
- package/native/shared/src/ui/mod.rs +252 -0
- package/native/shared/src/ui/responses.rs +61 -0
- package/native/tvos/Cargo.lock +576 -27
- package/native/tvos/Cargo.toml +2 -0
- package/native/visionos/Cargo.lock +571 -22
- package/native/visionos/Cargo.toml +2 -0
- package/native/watchos/src/ffi_stubs.rs +27 -0
- package/native/web/Cargo.lock +346 -11
- package/native/web/Cargo.toml +6 -0
- package/native/web/bloom_glue.js +84 -11
- package/native/web/build.sh +150 -34
- package/native/web/src/lib.rs +2 -0
- package/native/web/src/ui_ffi.rs +148 -0
- package/native/windows/Cargo.lock +638 -38
- package/native/windows/Cargo.toml +3 -0
- package/native/windows/src/lib.rs +50 -1
- package/native/windows/src/windows_text.rs +69 -0
- package/package.json +91 -2
- package/src/debug-ui/index.ts +4 -0
- package/src/debug-ui/types.ts +1 -0
- package/src/game/adapters/audio-source-component.ts +67 -0
- package/src/game/adapters/rigid-body-component.ts +69 -0
- package/src/game/adapters/scene-node-component.ts +49 -0
- package/src/game/game-component.ts +89 -0
- package/src/game/game-object.ts +338 -0
- package/src/game/game-scene.ts +303 -0
- package/src/game/index.ts +7 -0
- package/src/game/transform.ts +315 -0
- package/src/index.ts +27 -0
- package/src/ui/api.ts +240 -0
- package/src/ui/index.ts +5 -0
- package/src/ui/opcodes.ts +66 -0
- package/src/ui/types.ts +82 -0
package/src/ui/types.ts
ADDED
|
@@ -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;
|