Prévia do scratchblocks antes de exportar, copiar para o fórum e colar

- "Exportar scratchblocks" abre uma prévia do texto (rolável) com Copiar
  (já com [scratchblocks]...[/scratchblocks]), Salvar... e Fechar.
- "Colar scratchblocks": um script copiado do fórum vira uma aba nova.
- graphics: área de transferência no contrato (tb_graphics_set_clipboard /
  tb_graphics_get_clipboard); o SDL2 usa a do sistema e o backend nulo,
  uma memória interna (testável no harness).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mguinhosandClaude Opus 5.5 committed 2026-10-22 18:06:46 -03:00
1 parent d842890b0b
commit d9449a568e
6 files changed
+251 -11

No files matched your search

@@ -121,6 +121,9 @@ typedef struct TinyBlocks_GraphicsBackend {
void (*window_present)(void* win, const TinyBlocks_RenderableBlock* rb);
float (*measure_text)(const char* text, float font_size); /* NULL = estimativa */
void (*frame_wait)(void); /* NULL = ~16 ms */
/* Area de transferencia (opcionais; NULL = memoria interna do graphics) */
bool (*clipboard_set)(const char* text);
char* (*clipboard_get)(void); /* malloc; NULL = vazia */
} TinyBlocks_GraphicsBackend;
/* Símbolo exportado por um backend carregado como .so */
@@ -139,6 +142,11 @@ TB_API const TinyBlocks_GraphicsBackend* tb_graphics_null_backend(void);
/* Largura de um texto na fonte do backend */
TB_API float tb_graphics_measure_text(const char* text, float font_size);
/* Area de transferencia do sistema (copiar/colar). get devolve malloc
(libere com free) ou NULL se estiver vazia. */
TB_API bool tb_graphics_set_clipboard(const char* text);
TB_API char* tb_graphics_get_clipboard(void);
/* Loop principal: roda todas as janelas abertas até a principal fechar */
TB_API void tb_graphics_run(TinyBlocks* rt);
TB_API bool tb_graphics_window_is_open(TinyBlocks_Block* window);