39 #include "../ui_nodes.h"
40 #include "../ui_parse.h"
41 #include "../ui_behaviour.h"
42 #include "../ui_render.h"
46 #include "../../client.h"
48 #include "../../../common/scripts_lua.h"
50 #define EXTRADATA_TYPE imageExtraData_t
51 #define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
52 #define EXTRADATACONST(node) UI_EXTRADATACONST(node, EXTRADATA_TYPE)
64 }
else if (node->
image) {
94 innerBoxPos[0] = outerBoxPos[0];
97 innerBoxPos[0] = outerBoxPos[0] + (outerBoxSize[0] * 0.5) - (innerBoxSize[0] * 0.5);
100 innerBoxPos[0] = outerBoxPos[0] + outerBoxSize[0] - innerBoxSize[0];
105 innerBoxPos[1] = outerBoxPos[1];
108 innerBoxPos[1] = outerBoxPos[1] + (outerBoxSize[1] * 0.5) - (innerBoxSize[1] * 0.5);
111 innerBoxPos[1] = outerBoxPos[1] + outerBoxSize[1] - innerBoxSize[1];
114 innerBoxPos[1] = outerBoxPos[1];
143 if (node->mousefx && node->
state) {
146 color[3] = node->
color[3];
171 const float ratio = (float) image->
width / (
float) image->
height;
172 if (size[1] * ratio > size[0]) {
191 if (node->mousefx && node->
state) {
200 behaviour->
name =
"image";
bool Q_strnull(const char *string)
struct uiAction_s * onWheelDown
static const vec3_t scale
struct uiAction_s * onMouseEnter
void draw(uiNode_t *node) override
Draws the image node.
struct uiAction_s * onMouseLeave
static void UI_ImageAlignBoxInBox(vec2_t outerBoxPos, vec2_t outerBoxSize, vec2_t innerBoxSize, align_t align, vec2_t innerBoxPos)
Get position of a inner box inside an outer box according to align param.
#define UI_RegisterNodeProperty(BEHAVIOUR, NAME, TYPE, OBJECTTYPE, ATTRIBUTE)
Initialize a property.
struct uiAction_s * onClick
void onLoaded(uiNode_t *node) override
Handled after the end of the load of the node from the script (all data and/or child are set) ...
#define VectorScale(in, scale, out)
#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 Com_Error(int code, const char *fmt,...)
align_t
We need this here for checking the boundaries from script values.
struct uiAction_s * onWheelUp
#define Vector2Set(v, x, y)
struct uiAction_s * onMiddleClick
SharedPtr< uiNode > UINodePtr
const struct image_s * UI_LoadImage(const char *name)
Searches for an image in the image array.
const char * UI_GetPath(const uiNode_t *node)
Return a path from a window to a node.
void UI_DrawNormImage(bool flip, float x, float y, float w, float h, float sh, float th, float sl, float tl, const image_t *image)
Draw a normalized (to the screen) image.
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
const char * UI_GetReferenceString(const uiNode_t *const node, const char *ref)
Atomic structure used to define most of the UI.
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.
struct uiAction_s * onRightClick
node behaviour, how a node work
struct uiAction_s * onWheel
#define Vector2Copy(src, dest)
void UI_RegisterImageNode(uiBehaviour_t *behaviour)