Adiciona tinyblocks-base64 e tinyblocks-curves (listas de pontos)

This commit is contained in:
mguinhos committed 2026-10-20 20:59:17 -03:00
1 parent a14c7f9937
commit b1b15a4c49
12 files changed
+815 -9

No files matched your search

+21 -4
View File
@@ -1221,17 +1221,34 @@ static int hit_slot(Tab* T, int bi, float x, float y) {
/* ===
* Renderização de blocos
* === */
/* Campo de nome de variavel (slot 0 de Variables.Get/Set/Change):
* desenhado laranja (cor da categoria), como no Scratch. */
static bool slot_is_var_name(const TinyBlocks_TypeBlock* t, int s) {
if (!t || !t->type_name || s != 0) return false;
const char* n = t->type_name;
return strcmp(n, "Variables.Get") == 0 ||
strcmp(n, "Variables.Set") == 0 ||
strcmp(n, "Variables.Change") == 0;
}
static void draw_slot(TinyBlocks_RenderableBlock* rb, const EdBlock* b, int s,
float x, float y, Col dark, bool editing) {
float sx = x + b->slot_x[s], sy = y + b->slot_y[s];
float sw = b->slot_w[s], sh = b->slot_h[s];
if (slot_is_bool(b->type, s)) { draw_hex(rb, sx, sy, sw, sh, col_mul(dark, 0.9f)); return; }
bool varname = slot_is_var_name(b->type, s);
/* Laranja num tom mais escuro que o bloco, para o campo aparecer
* (como o "vinco" do dropdown de variavel do Scratch). */
Col border = varname ? col_mul(COL_VAR, 0.60f) : COLA(0,0,0,40);
Col fill = varname ? col_mul(COL_VAR, 0.82f) : COL_WHITE;
Col txt = varname ? COL_WHITE : COL_TEXT;
const char* src = slot_src(b, s);
int lines = text_lines(src);
float rad = lines > 1 ? 4.f : sh*0.5f;
rb_fill_rrect(rb, sx, sy, sw, sh, rad, editing ? COL_MENU : COLA(0,0,0,40));
rb_fill_rrect(rb, sx+1, sy+1, sw-2, sh-2, rad-1, COL_WHITE);
rb_fill_rrect(rb, sx, sy, sw, sh, rad, editing ? COL_MENU : border);
rb_fill_rrect(rb, sx+1, sy+1, sw-2, sh-2, rad-1, fill);
char line[64];
float ly = sy + (sh - lines*SLOT_LINE_H)*0.5f + SLOT_LINE_H*0.5f;
@@ -1240,11 +1257,11 @@ static void draw_slot(TinyBlocks_RenderableBlock* rb, const EdBlock* b, int s,
text_line(src, l, line, sizeof(line));
float lw = tw(line, FS);
float lx = lines > 1 ? sx + 7 : sx + (sw - lw)*0.5f;
rb_text_c(rb, lx, ly, line, COL_TEXT, FS);
rb_text_c(rb, lx, ly, line, txt, FS);
end_x = lx + lw;
ly += SLOT_LINE_H;
}
if (editing) rb_fill_rect(rb, end_x + 1, ly - SLOT_LINE_H - 7, 1.5f, 14, COL_TEXT);
if (editing) rb_fill_rect(rb, end_x + 1, ly - SLOT_LINE_H - 7, 1.5f, 14, txt);
}
static void render_chain(Ed* ed, TinyBlocks_RenderableBlock* rb, Tab* T, int head, float ox, float oy);