|
|
@ -213,25 +213,24 @@ int main(void) |
|
|
|
// fill background
|
|
|
|
// fill background
|
|
|
|
SDL_SetRenderDrawColor(r, 0, 0, 0, 0xff); |
|
|
|
SDL_SetRenderDrawColor(r, 0, 0, 0, 0xff); |
|
|
|
SDL_RenderClear(r); |
|
|
|
SDL_RenderClear(r); |
|
|
|
for (int i = 0; i < ctx->cmd_stack.idx; i++) { |
|
|
|
for (ug_cmd_t *cmd = NULL; (cmd = ug_cmd_next(ctx));) { |
|
|
|
ug_cmd_t cmd = ctx->cmd_stack.items[i]; |
|
|
|
switch (cmd->type) { |
|
|
|
switch (cmd.type) { |
|
|
|
|
|
|
|
case UG_CMD_RECT: |
|
|
|
case UG_CMD_RECT: |
|
|
|
{ |
|
|
|
{ |
|
|
|
ug_color_t col = cmd.rect.color; |
|
|
|
ug_color_t col = cmd->rect.color; |
|
|
|
SDL_Rect sr = { |
|
|
|
SDL_Rect sr = { |
|
|
|
.x = cmd.rect.x, |
|
|
|
.x = cmd->rect.x, |
|
|
|
.y = cmd.rect.y, |
|
|
|
.y = cmd->rect.y, |
|
|
|
.w = cmd.rect.w, |
|
|
|
.w = cmd->rect.w, |
|
|
|
.h = cmd.rect.h, |
|
|
|
.h = cmd->rect.h, |
|
|
|
}; |
|
|
|
}; |
|
|
|
SDL_SetRenderDrawColor(r, col.r, col.g, col.b, col.a); |
|
|
|
SDL_SetRenderDrawColor(r, col.r, col.g, col.b, col.a); |
|
|
|
SDL_RenderFillRect(r, &sr); |
|
|
|
SDL_RenderFillRect(r, &sr); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case UG_CMD_TEXT: |
|
|
|
case UG_CMD_TEXT: |
|
|
|
SDL_SetRenderDrawColor(r, cmd.text.color.r, cmd.text.color.g, cmd.text.color.b, cmd.text.color.a); |
|
|
|
SDL_SetRenderDrawColor(r, cmd->text.color.r, cmd->text.color.g, cmd->text.color.b, cmd->text.color.a); |
|
|
|
STBTTF_RenderText(r, font, cmd.text.x, cmd.text.y, cmd.text.str); |
|
|
|
STBTTF_RenderText(r, font, cmd->text.x, cmd->text.y, cmd->text.str); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: break; |
|
|
|
default: break; |
|
|
|
} |
|
|
|
} |
|
|
|