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:
1 parent
d842890b0b
commit
d9449a568e
6 files changed
+251
-11
No files matched your search
@@ -145,6 +145,23 @@ static float estimate_text(const char* s, float fs) {
|
||||
return w * fs;
|
||||
}
|
||||
|
||||
/* Area de transferencia: a do backend, ou esta memoria (backend nulo/testes) */
|
||||
static char* s_clip = NULL;
|
||||
|
||||
bool tb_graphics_set_clipboard(const char* text) {
|
||||
const TinyBlocks_GraphicsBackend* b = backend_ready();
|
||||
if (b->clipboard_set) return b->clipboard_set(text ? text : "");
|
||||
free(s_clip);
|
||||
s_clip = text ? strdup(text) : NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
char* tb_graphics_get_clipboard(void) {
|
||||
const TinyBlocks_GraphicsBackend* b = backend_ready();
|
||||
if (b->clipboard_get) return b->clipboard_get();
|
||||
return s_clip ? strdup(s_clip) : NULL;
|
||||
}
|
||||
|
||||
float tb_graphics_measure_text(const char* text, float font_size) {
|
||||
if (!text || !text[0]) return 0.f;
|
||||
const TinyBlocks_GraphicsBackend* b = backend_ready();
|
||||
|
||||
Reference in new issue
Block a user