GRW ScriptHook 0.11.0
Plugin API for Ghost Recon Wildlands
Loading...
Searching...
No Matches
Native UI

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.

Detailed Description

Engine widgets in scenes of our own; see docs/ui.md.

Macro Definition Documentation

◆ SH_PT_FLOAT

#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.

◆ SH_PT_BOOL

#define SH_PT_BOOL   2

◆ SH_PT_UINT

#define SH_PT_UINT   3

◆ SH_PT_VEC2

#define SH_PT_VEC2   4

◆ SH_PT_VEC3

#define SH_PT_VEC3   5

◆ SH_PT_STRING

#define SH_PT_STRING   6

◆ SH_P_POSITION

#define SH_P_POSITION   0x01

Widget vec3, local position.

◆ SH_P_ROTATION3

#define SH_P_ROTATION3   0x02

Widget vec3.

◆ SH_P_ROTATION

#define SH_P_ROTATION   0x03

Widget float, degrees.

◆ SH_P_COLOUR

#define SH_P_COLOUR   0x05

Widget vec3, 0..255.

◆ SH_P_ALPHA

#define SH_P_ALPHA   0x06

Widget float, 0..1.

◆ SH_P_VISIBLE

#define SH_P_VISIBLE   0x07

Widget bool.

◆ SH_P_SCALE

#define SH_P_SCALE   0x35

Widget vec3.

◆ SH_P_TEXT

#define SH_P_TEXT   0x08

Label string.

◆ SH_P_AUTOSIZE

#define SH_P_AUTOSIZE   0x09

Label bool.

◆ SH_P_STYLE

#define SH_P_STYLE   0x0A

Label string.

◆ SH_P_FONTSIZE

#define SH_P_FONTSIZE   0x0C

Label float.

◆ SH_P_LINEGAP

#define SH_P_LINEGAP   0x0E

Label float.

◆ SH_P_SIZE

#define SH_P_SIZE   0x0F

Label vec2.

◆ SH_P_IMAGE

#define SH_P_IMAGE   0x2A

Image string.

◆ SH_P_UV0

#define SH_P_UV0   0x38

Image vec2.

◆ SH_P_UV1

#define SH_P_UV1   0x39

Image vec2.

◆ SH_P_CONTSIZE

#define SH_P_CONTSIZE   0x3E

Container vec2.

◆ SH_W_CONTAINER

#define SH_W_CONTAINER   1

Widget classes for ShUiCreate.

A panel is a container with a tinted quad behind it; a container is bare.

◆ SH_W_LABEL

#define SH_W_LABEL   2

◆ SH_W_IMAGE

#define SH_W_IMAGE   3

◆ SH_W_PANEL

#define SH_W_PANEL   4

◆ SH_UI_EV_DOWN

#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.

◆ SH_UI_EV_UP

#define SH_UI_EV_UP   2

◆ SH_UI_EV_MOVE

#define SH_UI_EV_MOVE   3

◆ SH_SCENE_DRONE

#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.

◆ SH_SCENE_BINOCULAR

#define SH_SCENE_BINOCULAR   "HUD_Binocular"

◆ SH_SCENE_VEHICLE

#define SH_SCENE_VEHICLE   "HUD_Vehicle"

◆ SH_SCENE_PAUSE

#define SH_SCENE_PAUSE   "Menu_TabbedPage"

◆ SH_SCENE_LOADOUT

#define SH_SCENE_LOADOUT   "MENU_LoadoutV2"

◆ SH_SCENE_MAP

#define SH_SCENE_MAP   "MENU_Map_Cursor"

◆ SH_SCENE_SKILLS

#define SH_SCENE_SKILLS   "MENU_Skills"

◆ SH_SCENE_COMWHEEL

#define SH_SCENE_COMWHEEL   "HUD_ComWheel"

◆ SH_SCENE_GAMEOVER

#define SH_SCENE_GAMEOVER   "MENU_GameOver"

◆ SH_SCENE_LOADING

#define SH_SCENE_LOADING   "MENU_LoadingScreen"

◆ SH_SCENE_CINEMATIC

#define SH_SCENE_CINEMATIC   "HUD_Cinematic"

Typedef Documentation

◆ ShUiInputFn

typedef int(*) ShUiInputFn(uint32_t scene, const ShUiEvent *e, void *user)

Function Documentation

◆ ShUiReady()

SH_API int ShUiReady ( void )

1 once the world is up; poll before building.

It also fires the reset callbacks after a world reload.

◆ ShUiEnable()

SH_API void ShUiEnable ( int on)

Kill switch, on by default.

◆ ShUiSetDefaultFont()

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.

◆ ShUiSetDefaultImage()

SH_API int ShUiSetDefaultImage ( const char * guid)

◆ ShUiGen()

SH_API int ShUiGen ( void )

Changes when the scene reloads; older ids are dead.

◆ ShSceneHandle()

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.

◆ ShUiPanel()

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.

◆ ShUiLabel()

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.

◆ ShUiImage()

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.

◆ ShUiSetText()

SH_API int ShUiSetText ( uint32_t id,
const char * text )

◆ ShUiSetPos()

SH_API int ShUiSetPos ( uint32_t id,
float x,
float y )

◆ ShUiSetSize()

SH_API int ShUiSetSize ( uint32_t id,
float w,
float h )

◆ ShUiSetColour()

SH_API int ShUiSetColour ( uint32_t id,
uint32_t rgb )

◆ ShUiSetAlpha()

SH_API int ShUiSetAlpha ( uint32_t id,
float alpha )

◆ ShUiShow()

SH_API int ShUiShow ( uint32_t id,
int visible )

Hiding a panel hides its children too.

◆ ShUiDestroy()

SH_API int ShUiDestroy ( uint32_t id)

Detaches the widget and its children from the tree.

◆ ShUiCreate()

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.

◆ ShUiPropType()

SH_API int ShUiPropType ( uint32_t id,
uint32_t prop )

0 when the widget's class has no such property.

◆ ShUiSetF()

SH_API int ShUiSetF ( uint32_t id,
uint32_t prop,
float v )

◆ ShUiSetU()

SH_API int ShUiSetU ( uint32_t id,
uint32_t prop,
uint32_t v )

◆ ShUiSetV()

SH_API int ShUiSetV ( uint32_t id,
uint32_t prop,
const float * v,
int n )

◆ ShUiSetS()

SH_API int ShUiSetS ( uint32_t id,
uint32_t prop,
const char * utf8 )

◆ ShUiGetF()

SH_API int ShUiGetF ( uint32_t id,
uint32_t prop,
float * out )

◆ ShUiGetU()

SH_API int ShUiGetU ( uint32_t id,
uint32_t prop,
uint32_t * out )

◆ ShUiGetV()

SH_API int ShUiGetV ( uint32_t id,
uint32_t prop,
float * out,
int n )

◆ ShUiGetS()

SH_API int ShUiGetS ( uint32_t id,
uint32_t prop,
char * out,
int n )

◆ ShUiSetAutoSize()

SH_API int ShUiSetAutoSize ( uint32_t id,
int autoW,
int autoH )

Label size follows its text on the axes set to 1.

◆ ShUiMeasure()

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.

◆ ShUiTextureCreate()

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.

◆ ShUiImageSet()

SH_API int ShUiImageSet ( uint32_t id,
uint32_t texture )

Shows a texture on an image widget or panel plate.

◆ ShUiPropCount()

SH_API int ShUiPropCount ( void )

The resolved property records: class, id, type.

◆ ShUiPropAt()

SH_API int ShUiPropAt ( int i,
char * cls,
int n,
uint32_t * prop,
int * type )

◆ ShUiSceneCreate()

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.

◆ ShUiSceneSetOrder()

SH_API int ShUiSceneSetOrder ( uint32_t scene,
int order )

◆ ShUiSceneShow()

SH_API int ShUiSceneShow ( uint32_t scene,
int visible )

◆ ShUiSceneDestroy()

SH_API int ShUiSceneDestroy ( uint32_t scene)

Every widget of the scene, then the scene.

◆ ShUiCreateIn()

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.

◆ ShUiSetReset()

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.

◆ ShUiBegin()

SH_API int ShUiBegin ( void )

Edits between Begin and Commit run as one job.

Creates and reads still run at once. Per thread.

◆ ShUiCommit()

SH_API int ShUiCommit ( void )

◆ ShUiAbort()

SH_API int ShUiAbort ( void )

◆ ShUiCommitAsync()

SH_API int ShUiCommitAsync ( void(* done )(int ok, void *user),
void * user )

Commit from a worker; done(ok, user) when it landed.

◆ ShUiReparent()

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.

◆ ShUiChildCount()

SH_API int ShUiChildCount ( uint32_t id)

◆ ShUiChildAt()

SH_API uint32_t ShUiChildAt ( uint32_t id,
int index )

◆ ShUiSetInput()

SH_API int ShUiSetInput ( uint32_t scene,
ShUiInputFn fn,
void * user )

◆ ShUiFocus()

SH_API int ShUiFocus ( uint32_t scene,
int take )

◆ ShUiFocused()

SH_API uint32_t ShUiFocused ( void )

◆ ShBlockKey()

SH_API int ShBlockKey ( int vk,
int on )

One virtual key hidden from the game until released.

◆ ShCaptureKeys()

SH_API int ShCaptureKeys ( int on)

Every key but the escapes hidden, focus uses this.

◆ ShGameSceneActive()

SH_API int ShGameSceneActive ( const char * name)

1 when a scene of that name was drawn last frame.

◆ ShGameScenes()

SH_API int ShGameScenes ( char * buf,
int n )

Comma separated names drawn last frame; the count.