ff_i_nui
NUI helper functions.
Convenience wrappers around the native NUI JSON builder API for creating and updating NUI windows and binds.
-
float GetNuiHorizontalCenterForWindow(object oPC, float fWindowWidth)
- Parameters:
oPC – The player whose GUI width is queried.
fWindowWidth – Width of the NUI window to center.
Get the horizontal center for window.
-
float GetNuiVerticalCenterForWindow(object oPC, float fWindowHeight)
- Parameters:
oPC – The player whose GUI height is queried.
fWindowHeight – Height of the NUI window to center.
Get the vertical center for window.
Source code
// @code
#include "nw_inc_nui"
// -----------------------------------------------------------------------------
//! @brief Get the horizontal center for window.
//! @param oPC The player whose GUI width is queried.
//! @param fWindowWidth Width of the NUI window to center.
float GetNuiHorizontalCenterForWindow(object oPC, float fWindowWidth);
float GetNuiHorizontalCenterForWindow(object oPC, float fWindowWidth)
{
return IntToFloat(GetPlayerDeviceProperty(oPC, PLAYER_DEVICE_PROPERTY_GUI_WIDTH)) / 2 - fWindowWidth / 2;
}
// -----------------------------------------------------------------------------
//! @brief Get the vertical center for window.
//! @param oPC The player whose GUI height is queried.
//! @param fWindowHeight Height of the NUI window to center.
float GetNuiVerticalCenterForWindow(object oPC, float fWindowHeight);
float GetNuiVerticalCenterForWindow(object oPC, float fWindowHeight)
{
return IntToFloat(GetPlayerDeviceProperty(oPC, PLAYER_DEVICE_PROPERTY_GUI_HEIGHT)) / 2 - fWindowHeight / 2;
}