Skip to content

Commit 0bbdda3

Browse files
Refactor UnityModule type declaration to improve structure and add missing properties
1 parent 62b22fe commit 0bbdda3

File tree

1 file changed

+59
-3
lines changed

1 file changed

+59
-3
lines changed
Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
import { UnityBooleanLike } from "./unity-boolean-like";
2+
import { UnityEventParameter } from "./unity-event-parameters";
23

34
/**
45
* Type declaration for the UnityModule.
56
*/
67
type UnityModule = {
8+
HEAP8: Int8Array;
9+
HEAP16: Int16Array;
10+
HEAP32: Int32Array;
11+
HEAPF32: Float32Array;
12+
HEAPF64: Float64Array;
13+
HEAPU8: Uint8Array;
14+
HEAPU16: Uint16Array;
15+
HEAPU32: Uint32Array;
16+
717
/**
818
* Stringifies a pointer to a string.
919
* @param pointer The pointer to the string.
@@ -13,21 +23,67 @@ type UnityModule = {
1323
Pointer_stringify(pointer: number, length: number): string;
1424

1525
/**
16-
* Converts a pointer to a string.
17-
* @param pointer The pointer to the string.
26+
* Cleans up the UnityInstance and releases resources.
1827
*/
19-
UTF8ToString(pointer: number): string;
28+
QuitCleanup: VoidFunction;
29+
30+
/**
31+
* Sends a message to the UnityInstance to invoke a public method.
32+
* @param gameObjectName the name of the game object in your Unity scene.
33+
* @param methodName the name of the public method on the game object.
34+
* @param parameter an optional parameter to pass along to the method.
35+
*/
36+
SendMessage(
37+
gameObjectName: string,
38+
methodName: string,
39+
parameter?: UnityEventParameter
40+
): void;
2041

2142
/**
2243
* Enables or disabled the fullscreen mode of the UnityInstance.
2344
* @param fullScreen sets the fullscreen mode.
2445
*/
2546
SetFullscreen(fullScreen: UnityBooleanLike): void;
2647

48+
/**
49+
* Returns the current system information of the UnityInstance.
50+
* @returns An object containing system information.
51+
*/
52+
SystemInfo: {
53+
browser: string;
54+
browserVersion: string;
55+
gpu: string;
56+
hasCursorLock: boolean;
57+
hasFullscreen: boolean;
58+
hasThreads: boolean;
59+
hasWasm: boolean;
60+
hasWasmThreads: boolean;
61+
hasWebGL: 2 | 1;
62+
height: number;
63+
language: string;
64+
mobile: boolean;
65+
os: string;
66+
osVersion: string;
67+
userAgent: string;
68+
width: number;
69+
};
70+
71+
/**
72+
* Converts a pointer to a string.
73+
* @param pointer The pointer to the string.
74+
*/
75+
UTF8ToString(pointer: number): string;
76+
2777
/**
2878
* A reference to the Unity Instance's Canvas.
2979
*/
3080
canvas?: HTMLCanvasElement;
81+
82+
/**
83+
* A reference to the Unity Instance's WebGL context attributes.
84+
* This is used to configure the WebGL context for the Unity instance.
85+
*/
86+
webglContextAttributes: WebGLContextAttributes;
3187
};
3288

3389
export type { UnityModule };

0 commit comments

Comments
 (0)