25 #include "../ui_nodes.h"
26 #include "../ui_parse.h"
27 #include "../ui_internal.h"
28 #include "../ui_render.h"
32 #include "../../renderer/r_draw.h"
34 #include "../../../common/scripts_lua.h"
36 #define EXTRADATA_TYPE lineChartExtraData_t
37 #define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
71 axes[4] = (
int) node->
box.
size[0];
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";
bool Q_strnull(const char *string)
void R_DrawLineStrip(int points, int *verts)
2 dimensional line strip
void draw(uiNode_t *node) override
Drawing routine of the lineChart node.
Structure describes a line.
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
void Com_Printf(const char *const fmt,...)
void UI_RegisterLineChartNode(uiBehaviour_t *behaviour)
Registers lineChart node.
void LIST_Delete(linkedList_t **list)
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.
#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 Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
SharedPtr< uiNode > UINodePtr
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...
Atomic structure used to define most of the UI.
struct line_s line_t
Structure describes a line.
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.
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
#define Mem_PoolAllocTypeN(type, n, pool)
#define Q_strneq(a, b, n)
bool UI_ShowChartDots(uiNode_t *node, const char *id, bool visible)
Shows/hides small dots at data points of a chart.
node behaviour, how a node work
bool UI_ShowChartLine(uiNode_t *node, const char *id, bool visible)
Shows/hides a chart line.
#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 ...
bool UI_ClearLineChart(uiNode_t *node)
Clears all drawings froma lineChart.
bool UI_AddLineChartCoord(uiNode_t *node, const char *id, int x, int y)
Add a data point to a line chart.
void R_DrawFill(int x, int y, int w, int h, const vec4_t color)
Fills a box of pixels with a single color.
#define Vector4Copy(src, dest)
void deleteNode(uiNode_t *node) override
Cleanup tasks on removing a lineChart.