29 #include "../ui_main.h"
30 #include "../ui_actions.h"
31 #include "../ui_parse.h"
32 #include "../ui_behaviour.h"
33 #include "../ui_font.h"
34 #include "../ui_render.h"
35 #include "../ui_sound.h"
36 #include "../ui_sprite.h"
41 #include "../../../common/scripts_lua.h"
43 #define EXTRADATA_TYPE buttonExtraData_t
44 #define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
45 #define EXTRADATACONST(node) UI_EXTRADATACONST(node, EXTRADATA_TYPE)
47 #include "../../client.h"
54 const float* textColor;
65 }
else if (node->
state) {
69 textColor = node->
color;
85 const bool hasIcon =
EXTRADATA(node).icon !=
nullptr;
87 const bool hasText = text !=
nullptr && *text !=
'\0';
103 textPos[0] = content.
size[0];
104 const int availableTextWidth = inside.
size[0] - content.
size[0];
107 content.
size[0] += textWidth;
108 if (height > content.
size[1]) {
109 content.
size[1] = height;
110 iconPos[1] = (height - content.
size[1]) * 0.5;
112 textPos[1] = (content.
size[1] - height) * 0.5;
121 iconPos[0] += content.
pos[0];
122 iconPos[1] += content.
pos[1];
124 iconPos[0], iconPos[1],
EXTRADATA(node).icon->size[0],
EXTRADATA(node).icon->size[1]);
128 textPos[0] += content.
pos[0];
129 textPos[1] += content.
pos[1];
133 textPos[0], content.
pos[1], textWidth, content.
size[1],
180 behaviour->
name =
"button";
int UI_DrawStringInBox(const char *fontID, align_t align, int x, int y, int width, int height, const char *text, longlines_t method)
draw a line into a bounding box
void UI_DrawSpriteInBox(bool flip, const uiSprite_t *sprite, uiSpriteStatus_t status, int posX, int posY, int sizeX, int sizeY)
void alignBox(uiBox_t &inner, align_t direction)
void UI_DisableFlashing(void)
Disables flashing effect for UI nodes.
#define UI_RegisterExtradataNodeProperty(BEHAVIOUR, NAME, TYPE, EXTRADATATYPE, ATTRIBUTE)
Initialize a property from extradata of node.
void R_Color(const vec4_t rgba)
Change the color to given value.
void R_FontTextSize(const char *fontId, const char *text, int maxWidth, longlines_t method, int *width, int *height, int *lines, bool *isTruncated)
Supply information about the size of the text when it is linewrapped and rendered, without actually rendering it. Any of the output parameters may be nullptr.
align_t
We need this here for checking the boundaries from script values.
#define Vector4Set(v, r, g, b, a)
SharedPtr< uiNode > UINodePtr
#define UI_EXTRADATA(NODE, TYPE)
const char * UI_GetReferenceString(const uiNode_t *const node, const char *ref)
Atomic structure used to define most of the UI.
void UI_EnableFlashing(const vec4_t flashingColor, float speed)
Enables flashing effect for UI nodes.
void * UI_SWIG_TypeQuery(const char *name)
This function queries the SWIG type table for a type information structure. It is used in combination...
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
const char * UI_GetFontFromNode(const uiNode_t *const node)
Return the font for a specific node or default font.
node behaviour, how a node work
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
int UI_FontGetHeight(const char *fontID)
uiSprite_t * UI_GetSpriteByName(const char *name)
Return an sprite by is name.
void set(vec2_t pos, vec2_t size)