36#define EXTRADATA_TYPE lineChartExtraData_t
37#define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
42typedef struct line_s {
86 for (
int i = 0;
i < line->numPoints;
i++) {
87 R_DrawFill(line->pointList[
i * 2] - 2, line->pointList[
i * 2 + 1] - 2, 5, 5, line->lineColor);
114 if (line->numPoints > 0) {
138 Com_Printf(
"UI_AddLineChartLine: Missing line identifier for extending lineChart '%s'\n",
UI_GetPath(node));
146 Com_Printf(
"UI_AddLineChartLine: A line with id '%s' in lineChart '%s' already exists\n", newLine.
id,
UI_GetPath(node));
158 if (numPoints >= 0) {
165 return (
nullptr !=
LIST_Add(&(
EXTRADATA(node).lines), &newLine,
sizeof(newLine)));
181 Com_Printf(
"UI_AddLineChartCoord: Missing line identifier for extending lineChart '%s'\n",
UI_GetPath(node));
189 if (line->numPoints < line->maxPoints) {
190 line->pointList[line->numPoints * 2] = x;
191 line->pointList[line->numPoints * 2 + 1] = y;
195 Com_Printf(
"UI_AddLineChartCoord: Line '%s' has already reached it's max capacity %d in lineChart '%s'\n",
id, line->maxPoints,
UI_GetPath(node));
199 Com_Printf(
"UI_AddLineChartCoord: Line '%s' was not found in lineChart '%s'\n",
id,
UI_GetPath(node));
214 Com_Printf(
"UI_ShowChartLine: Missing line identifier for configuring lineChart '%s'\n",
UI_GetPath(node));
222 line->visible = visible;
226 Com_Printf(
"UI_ShowChartLine: Line '%s' was not found in lineChart '%s'\n",
id,
UI_GetPath(node));
241 Com_Printf(
"UI_ShowChartDots: Missing line identifier for configuring lineChart '%s'\n",
UI_GetPath(node));
249 line->dots = visible;
253 Com_Printf(
"UI_ShowChartDots: Line '%s' was not found in lineChart '%s'\n",
id,
UI_GetPath(node));
263 behaviour->
name =
"linechart";
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
void R_Color(const vec4_t rgba)
Change the color to given value.
void draw(uiNode_t *node) override
Drawing routine of the lineChart node.
void deleteNode(uiNode_t *node) override
Cleanup tasks on removing a lineChart.
void Com_Printf(const char *const fmt,...)
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
void LIST_Delete(linkedList_t **list)
#define LIST_Foreach(list, type, var)
Iterates over a linked list, it's safe to delete the returned entry from the list while looping over ...
#define Mem_PoolAllocTypeN(type, n, pool)
void R_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
void R_DrawLineStrip(int points, int *verts)
2 dimensional line strip
Header for lua script functions.
#define Q_strneq(a, b, n)
bool Q_strnull(const char *string)
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
Structure describes a line.
node behaviour, how a node work
Atomic structure used to define most of the UI.
#define UI_RegisterExtradataNodeProperty(BEHAVIOUR, NAME, TYPE, EXTRADATATYPE, ATTRIBUTE)
Initialize a property from extradata of node.
Internal data use by the UI package.
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.
SharedPtr< uiNode > UINodePtr
bool UI_AddLineChartCoord(uiNode_t *node, const char *id, int x, int y)
Add a data point to a line chart.
bool UI_ShowChartDots(uiNode_t *node, const char *id, bool visible)
Shows/hides small dots at data points of a chart.
bool UI_ShowChartLine(uiNode_t *node, const char *id, bool visible)
Shows/hides a chart line.
void UI_RegisterLineChartNode(uiBehaviour_t *behaviour)
Registers lineChart node.
bool UI_ClearLineChart(uiNode_t *node)
Clears all drawings froma lineChart.
bool UI_AddLineChartLine(uiNode_t *node, const char *id, bool visible, const vec4_t color, bool dots, int numPoints)
Add a line to the chart.
bool UI_ClearLineChart(uiNode_t *node)
Clears all drawings froma lineChart.
const char * UI_GetPath(const uiNode_t *node)
Return a path from a window to a node.
void UI_Transform(const vec3_t transform, const vec3_t rotate, const vec3_t scale)
Pushes a new matrix, normalize to current resolution and move, rotate and scale the matrix to the giv...
#define Vector4Copy(src, dest)