Lines Matching defs:cmd
938 /// const struct nk_command *cmd = 0;
939 /// nk_foreach(cmd, &ctx) {
940 /// switch (cmd->type) {
975 /// const struct nk_command *cmd = 0;
976 /// nk_foreach(cmd, &ctx) {
977 /// switch (cmd->type) {
1014 /// const struct nk_command *cmd = 0;
1015 /// nk_foreach(cmd, &ctx) {
1016 /// switch (cmd->type) {
1060 /// const struct nk_command *cmd = 0;
1061 /// nk_foreach(cmd, &ctx) {
1062 /// switch (cmd->type) {
1122 /// nk_draw_foreach(cmd, &ctx, &cmds) {
1123 /// if (!cmd->elem_count) continue;
1293 /// #define nk_draw_foreach(cmd,ctx, b)
1302 #define nk_draw_foreach(cmd,ctx, b) for((cmd)=nk__draw_begin(ctx, b); (cmd)!=0; (cmd)=nk__draw_next(cmd, b, ctx))
1371 /// const struct nk_command *cmd = 0;
1372 /// nk_foreach(cmd, &ctx) {
2622 /// const struct nk_command *cmd = 0;
2623 /// nk_foreach(cmd, &ctx) {
2624 /// switch (cmd->type) {
3251 /// const struct nk_command *cmd = 0;
3252 /// nk_foreach(cmd, &ctx) {
3253 /// switch (cmd->type) {
4762 #define nk_draw_list_foreach(cmd, can, b) for((cmd)=nk__draw_list_begin(can, b); (cmd)!=0; (cmd)=nk__draw_list_next(cmd, b, can))
8768 struct nk_command *cmd;
8776 cmd = (struct nk_command*)nk_buffer_alloc(b->base,NK_BUFFER_FRONT,size,align);
8777 if (!cmd) return 0;
8780 b->last = (nk_size)((nk_byte*)cmd - (nk_byte*)b->base->memory.ptr);
8781 unaligned = (nk_byte*)cmd + size;
8785 NK_MEMSET(cmd, 0, size + alignment);
8788 cmd->type = t;
8789 cmd->next = b->base->allocated + alignment;
8791 cmd->userdata = b->userdata;
8793 b->end = cmd->next;
8794 return cmd;
8799 struct nk_command_scissor *cmd;
8807 cmd = (struct nk_command_scissor*)
8808 nk_command_buffer_push(b, NK_COMMAND_SCISSOR, sizeof(*cmd));
8810 if (!cmd) return;
8811 cmd->x = (short)r.x;
8812 cmd->y = (short)r.y;
8813 cmd->w = (unsigned short)NK_MAX(0, r.w);
8814 cmd->h = (unsigned short)NK_MAX(0, r.h);
8820 struct nk_command_line *cmd;
8823 cmd = (struct nk_command_line*)
8824 nk_command_buffer_push(b, NK_COMMAND_LINE, sizeof(*cmd));
8825 if (!cmd) return;
8826 cmd->line_thickness = (unsigned short)line_thickness;
8827 cmd->begin.x = (short)x0;
8828 cmd->begin.y = (short)y0;
8829 cmd->end.x = (short)x1;
8830 cmd->end.y = (short)y1;
8831 cmd->color = c;
8838 struct nk_command_curve *cmd;
8842 cmd = (struct nk_command_curve*)
8843 nk_command_buffer_push(b, NK_COMMAND_CURVE, sizeof(*cmd));
8844 if (!cmd) return;
8845 cmd->line_thickness = (unsigned short)line_thickness;
8846 cmd->begin.x = (short)ax;
8847 cmd->begin.y = (short)ay;
8848 cmd->ctrl[0].x = (short)ctrl0x;
8849 cmd->ctrl[0].y = (short)ctrl0y;
8850 cmd->ctrl[1].x = (short)ctrl1x;
8851 cmd->ctrl[1].y = (short)ctrl1y;
8852 cmd->end.x = (short)bx;
8853 cmd->end.y = (short)by;
8854 cmd->color = col;
8860 struct nk_command_rect *cmd;
8868 cmd = (struct nk_command_rect*)
8869 nk_command_buffer_push(b, NK_COMMAND_RECT, sizeof(*cmd));
8870 if (!cmd) return;
8871 cmd->rounding = (unsigned short)rounding;
8872 cmd->line_thickness = (unsigned short)line_thickness;
8873 cmd->x = (short)rect.x;
8874 cmd->y = (short)rect.y;
8875 cmd->w = (unsigned short)NK_MAX(0, rect.w);
8876 cmd->h = (unsigned short)NK_MAX(0, rect.h);
8877 cmd->color = c;
8883 struct nk_command_rect_filled *cmd;
8892 cmd = (struct nk_command_rect_filled*)
8893 nk_command_buffer_push(b, NK_COMMAND_RECT_FILLED, sizeof(*cmd));
8894 if (!cmd) return;
8895 cmd->rounding = (unsigned short)rounding;
8896 cmd->x = (short)rect.x;
8897 cmd->y = (short)rect.y;
8898 cmd->w = (unsigned short)NK_MAX(0, rect.w);
8899 cmd->h = (unsigned short)NK_MAX(0, rect.h);
8900 cmd->color = c;
8907 struct nk_command_rect_multi_color *cmd;
8916 cmd = (struct nk_command_rect_multi_color*)
8917 nk_command_buffer_push(b, NK_COMMAND_RECT_MULTI_COLOR, sizeof(*cmd));
8918 if (!cmd) return;
8919 cmd->x = (short)rect.x;
8920 cmd->y = (short)rect.y;
8921 cmd->w = (unsigned short)NK_MAX(0, rect.w);
8922 cmd->h = (unsigned short)NK_MAX(0, rect.h);
8923 cmd->left = left;
8924 cmd->top = top;
8925 cmd->right = right;
8926 cmd->bottom = bottom;
8932 struct nk_command_circle *cmd;
8940 cmd = (struct nk_command_circle*)
8941 nk_command_buffer_push(b, NK_COMMAND_CIRCLE, sizeof(*cmd));
8942 if (!cmd) return;
8943 cmd->line_thickness = (unsigned short)line_thickness;
8944 cmd->x = (short)r.x;
8945 cmd->y = (short)r.y;
8946 cmd->w = (unsigned short)NK_MAX(r.w, 0);
8947 cmd->h = (unsigned short)NK_MAX(r.h, 0);
8948 cmd->color = c;
8953 struct nk_command_circle_filled *cmd;
8962 cmd = (struct nk_command_circle_filled*)
8963 nk_command_buffer_push(b, NK_COMMAND_CIRCLE_FILLED, sizeof(*cmd));
8964 if (!cmd) return;
8965 cmd->x = (short)r.x;
8966 cmd->y = (short)r.y;
8967 cmd->w = (unsigned short)NK_MAX(r.w, 0);
8968 cmd->h = (unsigned short)NK_MAX(r.h, 0);
8969 cmd->color = c;
8975 struct nk_command_arc *cmd;
8977 cmd = (struct nk_command_arc*)
8978 nk_command_buffer_push(b, NK_COMMAND_ARC, sizeof(*cmd));
8979 if (!cmd) return;
8980 cmd->line_thickness = (unsigned short)line_thickness;
8981 cmd->cx = (short)cx;
8982 cmd->cy = (short)cy;
8983 cmd->r = (unsigned short)radius;
8984 cmd->a[0] = a_min;
8985 cmd->a[1] = a_max;
8986 cmd->color = c;
8992 struct nk_command_arc_filled *cmd;
8995 cmd = (struct nk_command_arc_filled*)
8996 nk_command_buffer_push(b, NK_COMMAND_ARC_FILLED, sizeof(*cmd));
8997 if (!cmd) return;
8998 cmd->cx = (short)cx;
8999 cmd->cy = (short)cy;
9000 cmd->r = (unsigned short)radius;
9001 cmd->a[0] = a_min;
9002 cmd->a[1] = a_max;
9003 cmd->color = c;
9009 struct nk_command_triangle *cmd;
9020 cmd = (struct nk_command_triangle*)
9021 nk_command_buffer_push(b, NK_COMMAND_TRIANGLE, sizeof(*cmd));
9022 if (!cmd) return;
9023 cmd->line_thickness = (unsigned short)line_thickness;
9024 cmd->a.x = (short)x0;
9025 cmd->a.y = (short)y0;
9026 cmd->b.x = (short)x1;
9027 cmd->b.y = (short)y1;
9028 cmd->c.x = (short)x2;
9029 cmd->c.y = (short)y2;
9030 cmd->color = c;
9036 struct nk_command_triangle_filled *cmd;
9048 cmd = (struct nk_command_triangle_filled*)
9049 nk_command_buffer_push(b, NK_COMMAND_TRIANGLE_FILLED, sizeof(*cmd));
9050 if (!cmd) return;
9051 cmd->a.x = (short)x0;
9052 cmd->a.y = (short)y0;
9053 cmd->b.x = (short)x1;
9054 cmd->b.y = (short)y1;
9055 cmd->c.x = (short)x2;
9056 cmd->c.y = (short)y2;
9057 cmd->color = c;
9065 struct nk_command_polygon *cmd;
9069 size = sizeof(*cmd) + sizeof(short) * 2 * (nk_size)point_count;
9070 cmd = (struct nk_command_polygon*) nk_command_buffer_push(b, NK_COMMAND_POLYGON, size);
9071 if (!cmd) return;
9072 cmd->color = col;
9073 cmd->line_thickness = (unsigned short)line_thickness;
9074 cmd->point_count = (unsigned short)point_count;
9076 cmd->points[i].x = (short)points[i*2];
9077 cmd->points[i].y = (short)points[i*2+1];
9086 struct nk_command_polygon_filled *cmd;
9090 size = sizeof(*cmd) + sizeof(short) * 2 * (nk_size)point_count;
9091 cmd = (struct nk_command_polygon_filled*)
9093 if (!cmd) return;
9094 cmd->color = col;
9095 cmd->point_count = (unsigned short)point_count;
9097 cmd->points[i].x = (short)points[i*2+0];
9098 cmd->points[i].y = (short)points[i*2+1];
9107 struct nk_command_polyline *cmd;
9111 size = sizeof(*cmd) + sizeof(short) * 2 * (nk_size)point_count;
9112 cmd = (struct nk_command_polyline*) nk_command_buffer_push(b, NK_COMMAND_POLYLINE, size);
9113 if (!cmd) return;
9114 cmd->color = col;
9115 cmd->point_count = (unsigned short)point_count;
9116 cmd->line_thickness = (unsigned short)line_thickness;
9118 cmd->points[i].x = (short)points[i*2];
9119 cmd->points[i].y = (short)points[i*2+1];
9126 struct nk_command_image *cmd;
9135 cmd = (struct nk_command_image*)
9136 nk_command_buffer_push(b, NK_COMMAND_IMAGE, sizeof(*cmd));
9137 if (!cmd) return;
9138 cmd->x = (short)r.x;
9139 cmd->y = (short)r.y;
9140 cmd->w = (unsigned short)NK_MAX(0, r.w);
9141 cmd->h = (unsigned short)NK_MAX(0, r.h);
9142 cmd->img = *img;
9143 cmd->col = col;
9149 struct nk_command_custom *cmd;
9158 cmd = (struct nk_command_custom*)
9159 nk_command_buffer_push(b, NK_COMMAND_CUSTOM, sizeof(*cmd));
9160 if (!cmd) return;
9161 cmd->x = (short)r.x;
9162 cmd->y = (short)r.y;
9163 cmd->w = (unsigned short)NK_MAX(0, r.w);
9164 cmd->h = (unsigned short)NK_MAX(0, r.h);
9165 cmd->callback_data = usr;
9166 cmd->callback = cb;
9174 struct nk_command_text *cmd;
9194 cmd = (struct nk_command_text*)
9195 nk_command_buffer_push(b, NK_COMMAND_TEXT, sizeof(*cmd) + (nk_size)(length + 1));
9196 if (!cmd) return;
9197 cmd->x = (short)r.x;
9198 cmd->y = (short)r.y;
9199 cmd->w = (unsigned short)r.w;
9200 cmd->h = (unsigned short)r.h;
9201 cmd->background = bg;
9202 cmd->foreground = fg;
9203 cmd->font = font;
9204 cmd->length = length;
9205 cmd->height = font->height;
9206 NK_MEMCPY(cmd->string, string, (nk_size)length);
9207 cmd->string[length] = '\0';
9266 const struct nk_draw_command *cmd;
9274 cmd = nk_ptr_add(const struct nk_draw_command, memory, offset);
9275 return cmd;
9298 nk__draw_list_next(const struct nk_draw_command *cmd,
9304 if (!cmd || !buffer || !canvas)
9308 if (cmd <= end) return 0;
9309 return (cmd-1);
9346 struct nk_draw_command *cmd;
9349 cmd = (struct nk_draw_command*)
9352 if (!cmd) return 0;
9357 list->cmd_offset = (nk_size)(memory - (nk_byte*)cmd);
9360 cmd->elem_count = 0;
9361 cmd->clip_rect = clip;
9362 cmd->texture = texture;
9364 cmd->userdata = list->userdata;
9369 return cmd;
9376 struct nk_draw_command *cmd;
9381 cmd = nk_ptr_add(struct nk_draw_command, memory, size - list->cmd_offset);
9382 return (cmd - (list->cmd_count-1));
9454 struct nk_draw_command *cmd;
9463 cmd = nk_draw_list_command_last(list);
9465 cmd->elem_count += (unsigned int)count;
10000 struct nk_draw_command *cmd = 0;
10006 cmd = nk_draw_list_command_last(list);
10007 if (cmd && cmd->texture.ptr != list->config.null.texture.ptr)
10394 const struct nk_command *cmd;
10407 nk_foreach(cmd, ctx)
10410 ctx->draw_list.userdata = cmd->userdata;
10412 switch (cmd->type) {
10415 const struct nk_command_scissor *s = (const struct nk_command_scissor*)cmd;
10419 const struct nk_command_line *l = (const struct nk_command_line*)cmd;
10424 const struct nk_command_curve *q = (const struct nk_command_curve*)cmd;
10431 const struct nk_command_rect *r = (const struct nk_command_rect*)cmd;
10436 const struct nk_command_rect_filled *r = (const struct nk_command_rect_filled*)cmd;
10441 const struct nk_command_rect_multi_color *r = (const struct nk_command_rect_multi_color*)cmd;
10446 const struct nk_command_circle *c = (const struct nk_command_circle*)cmd;
10452 const struct nk_command_circle_filled *c = (const struct nk_command_circle_filled *)cmd;
10458 const struct nk_command_arc *c = (const struct nk_command_arc*)cmd;
10465 const struct nk_command_arc_filled *c = (const struct nk_command_arc_filled*)cmd;
10472 const struct nk_command_triangle *t = (const struct nk_command_triangle*)cmd;
10478 const struct nk_command_triangle_filled *t = (const struct nk_command_triangle_filled*)cmd;
10484 const struct nk_command_polygon*p = (const struct nk_command_polygon*)cmd;
10493 const struct nk_command_polygon_filled *p = (const struct nk_command_polygon_filled*)cmd;
10502 const struct nk_command_polyline *p = (const struct nk_command_polyline*)cmd;
10510 const struct nk_command_text *t = (const struct nk_command_text*)cmd;
10515 const struct nk_command_image *i = (const struct nk_command_image*)cmd;
10519 const struct nk_command_custom *c = (const struct nk_command_custom*)cmd;
10542 nk__draw_next(const struct nk_draw_command *cmd,
10545 return nk__draw_list_next(cmd, buffer, &ctx->draw_list);
15208 struct nk_command *cmd = 0;
15237 cmd = nk_ptr_add(struct nk_command, buffer, it->buffer.last);
15242 if (next) cmd->next = next->buffer.begin;
15254 cmd->next = buf->begin;
15255 cmd = nk_ptr_add(struct nk_command, buffer, buf->last);
15259 if (cmd) {
15262 cmd->next = ctx->overlay.begin;
15263 else cmd->next = ctx->memory.allocated;
15289 nk__next(struct nk_context *ctx, const struct nk_command *cmd)
15294 if (!ctx || !cmd || !ctx->count) return 0;
15295 if (cmd->next >= ctx->memory.allocated) return 0;
15297 next = nk_ptr_add_const(struct nk_command, buffer, cmd->next);