Converte símbolos Unicode decorativos dos comentários para ASCII
Substitui barras de caixa (─ ═ │ ┌ ┐ └ ┘ ├ ┤ ┬ ┴), travessões (—), setas (→ ←), reticências (…), bullets (•), multiplicação (×) e guillemets (› ‹) por equivalentes ASCII. Acentos portugueses são preservados.
This commit is contained in:
1 parent
1cc0ff9d02
commit
90d47bf8a0
36 files changed
+327
-327
No files matched your search
+12
-12
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* TinyBlocks — exemplo SDL2
|
||||
* TinyBlocks - exemplo SDL2
|
||||
*
|
||||
* Demonstra o uso da library tinyblocks-sdl2 registrada estaticamente.
|
||||
* Abre uma janela 640x480, desenha um retângulo pulsante e fecha ao pressionar
|
||||
@@ -11,11 +11,11 @@
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* ── Runtime ──────────────────────────────────────────────────────────── */
|
||||
/* -- Runtime --- */
|
||||
TinyBlocks* rt = NULL;
|
||||
if (!tinyblocks_init(&rt, NULL)) { fprintf(stderr, "init falhou\n"); return 1; }
|
||||
|
||||
/* ── Registra a library SDL2 estaticamente ────────────────────────────── */
|
||||
/* -- Registra a library SDL2 estaticamente --- */
|
||||
TinyBlocks_LibraryBlock* sdl2 = tb_library_register(rt, tb_sdl2_get_library());
|
||||
if (!sdl2) {
|
||||
fprintf(stderr, "Falha ao registrar SDL2: %s\n", tinyblocks_last_error(rt));
|
||||
@@ -25,7 +25,7 @@ int main(void)
|
||||
printf("Library '%s' carregada com %u blocos\n",
|
||||
sdl2->base.name, sdl2->block_count);
|
||||
|
||||
/* ── Busca os TypeBlocks que vamos usar ───────────────────────────────── */
|
||||
/* -- Busca os TypeBlocks que vamos usar --- */
|
||||
TinyBlocks_TypeBlock* T_Init = (TinyBlocks_TypeBlock*)tb_library_find(sdl2, "SDL2.Init");
|
||||
TinyBlocks_TypeBlock* T_Quit = (TinyBlocks_TypeBlock*)tb_library_find(sdl2, "SDL2.Quit");
|
||||
TinyBlocks_TypeBlock* T_Window = (TinyBlocks_TypeBlock*)tb_library_find(sdl2, "SDL2.Window");
|
||||
@@ -39,11 +39,11 @@ int main(void)
|
||||
TinyBlocks_TypeBlock* T_DestroyRend = (TinyBlocks_TypeBlock*)tb_library_find(sdl2, "SDL2.DestroyRenderer");
|
||||
TinyBlocks_TypeBlock* T_Delay = (TinyBlocks_TypeBlock*)tb_library_find(sdl2, "SDL2.Delay");
|
||||
|
||||
/* ── SDL2.Init ────────────────────────────────────────────────────────── */
|
||||
/* -- SDL2.Init --- */
|
||||
TinyBlocks_Block* b_init = tb_block_create(rt, T_Init);
|
||||
tb_block_eval(b_init, rt);
|
||||
|
||||
/* ── SDL2.Window ─────────────────────────────────────────────────────── */
|
||||
/* -- SDL2.Window --- */
|
||||
TinyBlocks_TextBlock* lit_title = tb_text_block_create(rt, "TinyBlocks SDL2");
|
||||
TinyBlocks_IntegerBlock* lit_cx = tb_integer_block_create(rt, -1); /* centered */
|
||||
TinyBlocks_IntegerBlock* lit_cy = tb_integer_block_create(rt, -1);
|
||||
@@ -58,12 +58,12 @@ int main(void)
|
||||
tb_block_connect(b_window, 4, &lit_h->base, 0);
|
||||
tb_block_eval(b_window, rt);
|
||||
|
||||
/* ── SDL2.Renderer ───────────────────────────────────────────────────── */
|
||||
/* -- SDL2.Renderer --- */
|
||||
TinyBlocks_Block* b_renderer = tb_block_create(rt, T_Renderer);
|
||||
tb_block_connect(b_renderer, 0, b_window, 0);
|
||||
tb_block_eval(b_renderer, rt);
|
||||
|
||||
/* ── Blocos reutilizáveis por frame ──────────────────────────────────── */
|
||||
/* -- Blocos reutilizáveis por frame --- */
|
||||
TinyBlocks_Block* b_poll = tb_block_create(rt, T_PollEvent);
|
||||
TinyBlocks_Block* b_bg_color = tb_block_create(rt, T_SetColor);
|
||||
TinyBlocks_Block* b_clear = tb_block_create(rt, T_Clear);
|
||||
@@ -93,7 +93,7 @@ int main(void)
|
||||
tb_block_connect(b_rect_color, 3, &lit_b2->base, 0);
|
||||
tb_block_connect(b_rect_color, 4, &lit_255->base, 0);
|
||||
|
||||
/* Retângulo dinâmico — usaremos IntegerBlocks mutáveis para posição */
|
||||
/* Retângulo dinâmico - usaremos IntegerBlocks mutáveis para posição */
|
||||
TinyBlocks_IntegerBlock* lit_rx = tb_integer_block_create(rt, 100);
|
||||
TinyBlocks_IntegerBlock* lit_ry = tb_integer_block_create(rt, 100);
|
||||
TinyBlocks_IntegerBlock* lit_rw = tb_integer_block_create(rt, 200);
|
||||
@@ -109,7 +109,7 @@ int main(void)
|
||||
TinyBlocks_IntegerBlock* lit_delay = tb_integer_block_create(rt, 16); /* ~60fps */
|
||||
tb_block_connect(b_delay, 0, &lit_delay->base, 0);
|
||||
|
||||
/* ── Loop principal ──────────────────────────────────────────────────── */
|
||||
/* -- Loop principal --- */
|
||||
printf("Janela aberta. Pressione Escape ou feche a janela para sair.\n");
|
||||
|
||||
int running = 1;
|
||||
@@ -135,7 +135,7 @@ int main(void)
|
||||
: 1.0 - (frame % 60) / 60.0)));
|
||||
tb_integer_block_set(lit_rx, 80 + offset);
|
||||
|
||||
/* Renderização — cada bloco é avaliado na ordem correta */
|
||||
/* Renderização - cada bloco é avaliado na ordem correta */
|
||||
b_bg_color->dirty = true; tb_block_eval(b_bg_color, rt);
|
||||
b_clear->dirty = true; tb_block_eval(b_clear, rt);
|
||||
b_rect_color->dirty = true; tb_block_eval(b_rect_color, rt);
|
||||
@@ -144,7 +144,7 @@ int main(void)
|
||||
b_delay->dirty = true; tb_block_eval(b_delay, rt);
|
||||
}
|
||||
|
||||
/* ── Limpeza SDL2 via blocos ──────────────────────────────────────────── */
|
||||
/* -- Limpeza SDL2 via blocos --- */
|
||||
TinyBlocks_Block* b_drend = tb_block_create(rt, T_DestroyRend);
|
||||
TinyBlocks_Block* b_dwin = tb_block_create(rt, T_DestroyWin);
|
||||
TinyBlocks_Block* b_quit = tb_block_create(rt, T_Quit);
|
||||
|
||||
Reference in new issue
Block a user