command iterator
This commit is contained in:
parent
4e95aeffc3
commit
f1205ca264
3 changed files with 24 additions and 11 deletions
14
ugui.c
14
ugui.c
|
|
@ -203,6 +203,16 @@ static void push_text_command(ug_ctx_t *ctx, ug_vec2_t pos, int size, ug_color_t
|
|||
}
|
||||
|
||||
|
||||
ug_cmd_t *ug_cmd_next(ug_ctx_t *ctx)
|
||||
{
|
||||
if(!ctx)
|
||||
return NULL;
|
||||
if (ctx->cmd_it < ctx->cmd_stack.idx)
|
||||
return &ctx->cmd_stack.items[ctx->cmd_it++];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*=============================================================================*
|
||||
* Context Operations *
|
||||
*=============================================================================*/
|
||||
|
|
@ -634,7 +644,7 @@ static void draw_container(ug_ctx_t *ctx, ug_container_t *cnt, const char *text)
|
|||
// TODO: center the text horizontally
|
||||
push_text_command(ctx,
|
||||
(ug_vec2_t){.x = draw_rect.x + bl,
|
||||
.y = draw_rect.y + bt + ts},
|
||||
.y = draw_rect.y + bt + ts/2},
|
||||
ts, s->text.color, text);
|
||||
}
|
||||
}
|
||||
|
|
@ -960,5 +970,7 @@ int ug_frame_end(ug_ctx_t *ctx)
|
|||
|
||||
ctx->frame++;
|
||||
|
||||
ctx->cmd_it = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue