|
GRW ScriptHook 0.11.0
Plugin API for Ghost Recon Wildlands
|
Engine widgets in scenes of our own; see docs/ui.md. More...
Data Structures | |
| struct | ShUiEvent |
Macros | |
| #define | SH_PT_FLOAT 1 |
| Properties by the engine's own ids, typed from its property tables at runtime. | |
| #define | SH_PT_BOOL 2 |
| #define | SH_PT_UINT 3 |
| #define | SH_PT_VEC2 4 |
| #define | SH_PT_VEC3 5 |
| #define | SH_PT_STRING 6 |
| #define | SH_P_POSITION 0x01 |
| Widget vec3, local position. | |
| #define | SH_P_ROTATION3 0x02 |
| Widget vec3. | |
| #define | SH_P_ROTATION 0x03 |
| Widget float, degrees. | |
| #define | SH_P_COLOUR 0x05 |
| Widget vec3, 0..255. | |
| #define | SH_P_ALPHA 0x06 |
| Widget float, 0..1. | |
| #define | SH_P_VISIBLE 0x07 |
| Widget bool. | |
| #define | SH_P_SCALE 0x35 |
| Widget vec3. | |
| #define | SH_P_TEXT 0x08 |
| Label string. | |
| #define | SH_P_AUTOSIZE 0x09 |
| Label bool. | |
| #define | SH_P_STYLE 0x0A |
| Label string. | |
| #define | SH_P_FONTSIZE 0x0C |
| Label float. | |
| #define | SH_P_LINEGAP 0x0E |
| Label float. | |
| #define | SH_P_SIZE 0x0F |
| Label vec2. | |
| #define | SH_P_IMAGE 0x2A |
| Image string. | |
| #define | SH_P_UV0 0x38 |
| Image vec2. | |
| #define | SH_P_UV1 0x39 |
| Image vec2. | |
| #define | SH_P_CONTSIZE 0x3E |
| Container vec2. | |
| #define | SH_W_CONTAINER 1 |
| Widget classes for ShUiCreate. | |
| #define | SH_W_LABEL 2 |
| #define | SH_W_IMAGE 3 |
| #define | SH_W_PANEL 4 |
| #define | SH_UI_EV_DOWN 1 |
| Input: the focused scene gets keys and pointer moves and captures the keyboard (only Esc, Alt, Tab, F4 and the Windows keys reach the game). | |
| #define | SH_UI_EV_UP 2 |
| #define | SH_UI_EV_MOVE 3 |
| #define | SH_SCENE_DRONE "HUD_Drone" |
| The game's UI state, from the scenes it drew last frame. | |
| #define | SH_SCENE_BINOCULAR "HUD_Binocular" |
| #define | SH_SCENE_VEHICLE "HUD_Vehicle" |
| #define | SH_SCENE_PAUSE "Menu_TabbedPage" |
| #define | SH_SCENE_LOADOUT "MENU_LoadoutV2" |
| #define | SH_SCENE_MAP "MENU_Map_Cursor" |
| #define | SH_SCENE_SKILLS "MENU_Skills" |
| #define | SH_SCENE_COMWHEEL "HUD_ComWheel" |
| #define | SH_SCENE_GAMEOVER "MENU_GameOver" |
| #define | SH_SCENE_LOADING "MENU_LoadingScreen" |
| #define | SH_SCENE_CINEMATIC "HUD_Cinematic" |
Typedefs | |
| typedef int(*) | ShUiInputFn(uint32_t scene, const ShUiEvent *e, void *user) |
Functions | |
| SH_API int | ShUiReady (void) |
| 1 once the world is up; poll before building. | |
| SH_API void | ShUiEnable (int on) |
| Kill switch, on by default. | |
| SH_API int | ShUiSetDefaultFont (const char *guid) |
| Font and plate texture for new widgets, by asset GUID ("873fe53f-3b90-db4d-9887-d3cc6edeaba9", storage order). | |
| SH_API int | ShUiSetDefaultImage (const char *guid) |
| SH_API int | ShUiGen (void) |
| Changes when the scene reloads; older ids are dead. | |
| SH_API uint64_t | ShSceneHandle (void) |
| The phoenix::Scene handle that hosts every ShUi widget, built and driven by the DLL itself; 0 until in game. | |
| SH_API uint32_t | ShUiPanel (float x, float y, float w, float h, uint32_t rgb, float alpha) |
| A container with a translucent quad behind it. | |
| SH_API uint32_t | ShUiLabel (uint32_t panel, float x, float y, float w, float h, const char *text, uint32_t rgb) |
| A line of text in the HUD font. | |
| SH_API uint32_t | ShUiImage (uint32_t panel, float x, float y, float w, float h, uint32_t rgb, float alpha) |
| A tinted quad, for bars and highlights. | |
| SH_API int | ShUiSetText (uint32_t id, const char *text) |
| SH_API int | ShUiSetPos (uint32_t id, float x, float y) |
| SH_API int | ShUiSetSize (uint32_t id, float w, float h) |
| SH_API int | ShUiSetColour (uint32_t id, uint32_t rgb) |
| SH_API int | ShUiSetAlpha (uint32_t id, float alpha) |
| SH_API int | ShUiShow (uint32_t id, int visible) |
| Hiding a panel hides its children too. | |
| SH_API int | ShUiDestroy (uint32_t id) |
| Detaches the widget and its children from the tree. | |
| SH_API uint32_t | ShUiCreate (uint32_t parent, int cls, float x, float y, float w, float h) |
| Any widget under any container (0 = the scene root), at any depth. | |
| SH_API int | ShUiPropType (uint32_t id, uint32_t prop) |
| 0 when the widget's class has no such property. | |
| SH_API int | ShUiSetF (uint32_t id, uint32_t prop, float v) |
| SH_API int | ShUiSetU (uint32_t id, uint32_t prop, uint32_t v) |
| SH_API int | ShUiSetV (uint32_t id, uint32_t prop, const float *v, int n) |
| SH_API int | ShUiSetS (uint32_t id, uint32_t prop, const char *utf8) |
| SH_API int | ShUiGetF (uint32_t id, uint32_t prop, float *out) |
| SH_API int | ShUiGetU (uint32_t id, uint32_t prop, uint32_t *out) |
| SH_API int | ShUiGetV (uint32_t id, uint32_t prop, float *out, int n) |
| SH_API int | ShUiGetS (uint32_t id, uint32_t prop, char *out, int n) |
| SH_API int | ShUiSetAutoSize (uint32_t id, int autoW, int autoH) |
| Label size follows its text on the axes set to 1. | |
| SH_API int | ShUiMeasure (uint32_t id, float *w, float *h) |
| The label's laid out box: its text bounds once an axis is automatic, otherwise the size that was set. | |
| SH_API uint32_t | ShUiTextureCreate (int w, int h, const uint8_t *rgba, int stride) |
| RGBA8 pixels to an engine texture, stride in bytes. | |
| SH_API int | ShUiImageSet (uint32_t id, uint32_t texture) |
| Shows a texture on an image widget or panel plate. | |
| SH_API int | ShUiPropCount (void) |
| The resolved property records: class, id, type. | |
| SH_API int | ShUiPropAt (int i, char *cls, int n, uint32_t *prop, int *type) |
| SH_API uint32_t | ShUiSceneCreate (const char *name, int order) |
| Scenes: layers of your own. | |
| SH_API int | ShUiSceneSetOrder (uint32_t scene, int order) |
| SH_API int | ShUiSceneShow (uint32_t scene, int visible) |
| SH_API int | ShUiSceneDestroy (uint32_t scene) |
| Every widget of the scene, then the scene. | |
| SH_API uint32_t | ShUiCreateIn (uint32_t scene, uint32_t parent, int cls, float x, float y, float w, float h) |
| A widget in a scene; parent 0 is that scene's root. | |
| SH_API int | ShUiSetReset (uint32_t scene, void(*fn)(uint32_t scene, void *user), void *user) |
| After a world reload, once the scene is back: the old widgets are gone, rebuild inside. | |
| SH_API int | ShUiBegin (void) |
| Edits between Begin and Commit run as one job. | |
| SH_API int | ShUiCommit (void) |
| SH_API int | ShUiAbort (void) |
| SH_API int | ShUiCommitAsync (void(*done)(int ok, void *user), void *user) |
| Commit from a worker; done(ok, user) when it landed. | |
| SH_API int | ShUiReparent (uint32_t id, uint32_t parent, int index) |
| Tree: move a widget under another container of the same scene at a sibling index (draw order); list children. | |
| SH_API int | ShUiChildCount (uint32_t id) |
| SH_API uint32_t | ShUiChildAt (uint32_t id, int index) |
| SH_API int | ShUiSetInput (uint32_t scene, ShUiInputFn fn, void *user) |
| SH_API int | ShUiFocus (uint32_t scene, int take) |
| SH_API uint32_t | ShUiFocused (void) |
| SH_API int | ShBlockKey (int vk, int on) |
| One virtual key hidden from the game until released. | |
| SH_API int | ShCaptureKeys (int on) |
| Every key but the escapes hidden, focus uses this. | |
| SH_API int | ShGameSceneActive (const char *name) |
| 1 when a scene of that name was drawn last frame. | |
| SH_API int | ShGameScenes (char *buf, int n) |
| Comma separated names drawn last frame; the count. | |
Engine widgets in scenes of our own; see docs/ui.md.
| #define SH_PT_FLOAT 1 |
Properties by the engine's own ids, typed from its property tables at runtime.
Any id the class has works.
| #define SH_PT_BOOL 2 |
| #define SH_PT_UINT 3 |
| #define SH_PT_VEC2 4 |
| #define SH_PT_VEC3 5 |
| #define SH_PT_STRING 6 |
| #define SH_P_POSITION 0x01 |
Widget vec3, local position.
| #define SH_P_ROTATION3 0x02 |
Widget vec3.
| #define SH_P_ROTATION 0x03 |
Widget float, degrees.
| #define SH_P_COLOUR 0x05 |
Widget vec3, 0..255.
| #define SH_P_ALPHA 0x06 |
Widget float, 0..1.
| #define SH_P_VISIBLE 0x07 |
Widget bool.
| #define SH_P_SCALE 0x35 |
Widget vec3.
| #define SH_P_TEXT 0x08 |
Label string.
| #define SH_P_AUTOSIZE 0x09 |
Label bool.
| #define SH_P_STYLE 0x0A |
Label string.
| #define SH_P_FONTSIZE 0x0C |
Label float.
| #define SH_P_LINEGAP 0x0E |
Label float.
| #define SH_P_SIZE 0x0F |
Label vec2.
| #define SH_P_IMAGE 0x2A |
Image string.
| #define SH_P_UV0 0x38 |
Image vec2.
| #define SH_P_UV1 0x39 |
Image vec2.
| #define SH_P_CONTSIZE 0x3E |
Container vec2.
| #define SH_W_CONTAINER 1 |
Widget classes for ShUiCreate.
A panel is a container with a tinted quad behind it; a container is bare.
| #define SH_W_LABEL 2 |
| #define SH_W_IMAGE 3 |
| #define SH_W_PANEL 4 |
| #define SH_UI_EV_DOWN 1 |
Input: the focused scene gets keys and pointer moves and captures the keyboard (only Esc, Alt, Tab, F4 and the Windows keys reach the game).
Coordinates 1920 x 1080.
| #define SH_UI_EV_UP 2 |
| #define SH_UI_EV_MOVE 3 |
| #define SH_SCENE_DRONE "HUD_Drone" |
The game's UI state, from the scenes it drew last frame.
Names are the scene's own; the common ones below.
| #define SH_SCENE_BINOCULAR "HUD_Binocular" |
| #define SH_SCENE_VEHICLE "HUD_Vehicle" |
| #define SH_SCENE_PAUSE "Menu_TabbedPage" |
| #define SH_SCENE_LOADOUT "MENU_LoadoutV2" |
| #define SH_SCENE_MAP "MENU_Map_Cursor" |
| #define SH_SCENE_SKILLS "MENU_Skills" |
| #define SH_SCENE_COMWHEEL "HUD_ComWheel" |
| #define SH_SCENE_GAMEOVER "MENU_GameOver" |
| #define SH_SCENE_LOADING "MENU_LoadingScreen" |
| #define SH_SCENE_CINEMATIC "HUD_Cinematic" |
| typedef int(*) ShUiInputFn(uint32_t scene, const ShUiEvent *e, void *user) |
| SH_API int ShUiReady | ( | void | ) |
1 once the world is up; poll before building.
It also fires the reset callbacks after a world reload.
| SH_API void ShUiEnable | ( | int | on | ) |
Kill switch, on by default.
| SH_API int ShUiSetDefaultFont | ( | const char * | guid | ) |
Font and plate texture for new widgets, by asset GUID ("873fe53f-3b90-db4d-9887-d3cc6edeaba9", storage order).
Defaults: the HUD font and the white 16x16 texture.
| SH_API int ShUiSetDefaultImage | ( | const char * | guid | ) |
| SH_API int ShUiGen | ( | void | ) |
Changes when the scene reloads; older ids are dead.
| SH_API uint64_t ShSceneHandle | ( | void | ) |
The phoenix::Scene handle that hosts every ShUi widget, built and driven by the DLL itself; 0 until in game.
| SH_API uint32_t ShUiPanel | ( | float | x, |
| float | y, | ||
| float | w, | ||
| float | h, | ||
| uint32_t | rgb, | ||
| float | alpha ) |
A container with a translucent quad behind it.
| SH_API uint32_t ShUiLabel | ( | uint32_t | panel, |
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| const char * | text, | ||
| uint32_t | rgb ) |
A line of text in the HUD font.
panel 0 is the root.
| SH_API uint32_t ShUiImage | ( | uint32_t | panel, |
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h, | ||
| uint32_t | rgb, | ||
| float | alpha ) |
A tinted quad, for bars and highlights.
| SH_API int ShUiSetText | ( | uint32_t | id, |
| const char * | text ) |
| SH_API int ShUiSetPos | ( | uint32_t | id, |
| float | x, | ||
| float | y ) |
| SH_API int ShUiSetSize | ( | uint32_t | id, |
| float | w, | ||
| float | h ) |
| SH_API int ShUiSetColour | ( | uint32_t | id, |
| uint32_t | rgb ) |
| SH_API int ShUiSetAlpha | ( | uint32_t | id, |
| float | alpha ) |
| SH_API int ShUiShow | ( | uint32_t | id, |
| int | visible ) |
Hiding a panel hides its children too.
| SH_API int ShUiDestroy | ( | uint32_t | id | ) |
Detaches the widget and its children from the tree.
| SH_API uint32_t ShUiCreate | ( | uint32_t | parent, |
| int | cls, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h ) |
Any widget under any container (0 = the scene root), at any depth.
Text, colour, alpha, UVs and the rest go through the property calls below.
| SH_API int ShUiPropType | ( | uint32_t | id, |
| uint32_t | prop ) |
0 when the widget's class has no such property.
| SH_API int ShUiSetF | ( | uint32_t | id, |
| uint32_t | prop, | ||
| float | v ) |
| SH_API int ShUiSetU | ( | uint32_t | id, |
| uint32_t | prop, | ||
| uint32_t | v ) |
| SH_API int ShUiSetV | ( | uint32_t | id, |
| uint32_t | prop, | ||
| const float * | v, | ||
| int | n ) |
| SH_API int ShUiSetS | ( | uint32_t | id, |
| uint32_t | prop, | ||
| const char * | utf8 ) |
| SH_API int ShUiGetF | ( | uint32_t | id, |
| uint32_t | prop, | ||
| float * | out ) |
| SH_API int ShUiGetU | ( | uint32_t | id, |
| uint32_t | prop, | ||
| uint32_t * | out ) |
| SH_API int ShUiGetV | ( | uint32_t | id, |
| uint32_t | prop, | ||
| float * | out, | ||
| int | n ) |
| SH_API int ShUiGetS | ( | uint32_t | id, |
| uint32_t | prop, | ||
| char * | out, | ||
| int | n ) |
| SH_API int ShUiSetAutoSize | ( | uint32_t | id, |
| int | autoW, | ||
| int | autoH ) |
Label size follows its text on the axes set to 1.
| SH_API int ShUiMeasure | ( | uint32_t | id, |
| float * | w, | ||
| float * | h ) |
The label's laid out box: its text bounds once an axis is automatic, otherwise the size that was set.
| SH_API uint32_t ShUiTextureCreate | ( | int | w, |
| int | h, | ||
| const uint8_t * | rgba, | ||
| int | stride ) |
RGBA8 pixels to an engine texture, stride in bytes.
Returns an id, 0 on failure; lives for the session.
| SH_API int ShUiImageSet | ( | uint32_t | id, |
| uint32_t | texture ) |
Shows a texture on an image widget or panel plate.
| SH_API int ShUiPropCount | ( | void | ) |
The resolved property records: class, id, type.
| SH_API int ShUiPropAt | ( | int | i, |
| char * | cls, | ||
| int | n, | ||
| uint32_t * | prop, | ||
| int * | type ) |
| SH_API uint32_t ShUiSceneCreate | ( | const char * | name, |
| int | order ) |
Scenes: layers of your own.
Scene 1 is the default. Order below 0 draws under the game's UI, the rest over it, lowest first.
| SH_API int ShUiSceneSetOrder | ( | uint32_t | scene, |
| int | order ) |
| SH_API int ShUiSceneShow | ( | uint32_t | scene, |
| int | visible ) |
| SH_API int ShUiSceneDestroy | ( | uint32_t | scene | ) |
Every widget of the scene, then the scene.
| SH_API uint32_t ShUiCreateIn | ( | uint32_t | scene, |
| uint32_t | parent, | ||
| int | cls, | ||
| float | x, | ||
| float | y, | ||
| float | w, | ||
| float | h ) |
A widget in a scene; parent 0 is that scene's root.
| SH_API int ShUiSetReset | ( | uint32_t | scene, |
| void(* | fn )(uint32_t scene, void *user), | ||
| void * | user ) |
After a world reload, once the scene is back: the old widgets are gone, rebuild inside.
| SH_API int ShUiBegin | ( | void | ) |
Edits between Begin and Commit run as one job.
Creates and reads still run at once. Per thread.
| SH_API int ShUiCommit | ( | void | ) |
| SH_API int ShUiAbort | ( | void | ) |
| SH_API int ShUiCommitAsync | ( | void(* | done )(int ok, void *user), |
| void * | user ) |
Commit from a worker; done(ok, user) when it landed.
| SH_API int ShUiReparent | ( | uint32_t | id, |
| uint32_t | parent, | ||
| int | index ) |
Tree: move a widget under another container of the same scene at a sibling index (draw order); list children.
| SH_API int ShUiChildCount | ( | uint32_t | id | ) |
| SH_API uint32_t ShUiChildAt | ( | uint32_t | id, |
| int | index ) |
| SH_API int ShUiSetInput | ( | uint32_t | scene, |
| ShUiInputFn | fn, | ||
| void * | user ) |
| SH_API int ShUiFocus | ( | uint32_t | scene, |
| int | take ) |
| SH_API uint32_t ShUiFocused | ( | void | ) |
| SH_API int ShBlockKey | ( | int | vk, |
| int | on ) |
One virtual key hidden from the game until released.
| SH_API int ShCaptureKeys | ( | int | on | ) |
Every key but the escapes hidden, focus uses this.
| SH_API int ShGameSceneActive | ( | const char * | name | ) |
1 when a scene of that name was drawn last frame.
| SH_API int ShGameScenes | ( | char * | buf, |
| int | n ) |
Comma separated names drawn last frame; the count.