Estado atual do TinyBlocks: editor estilo Scratch + graphics como interface
Snapshot do projeto antes de implementar o diálogo "Criar um Bloco": - runtime C block-based (src/, include/) - libraries: graphics (interface), sdl2 (backend), editor (estilo Scratch), python, mcp - exemplos (hello, sdl2, editor, vector, json, customappearance, python, mcp) - Makefile com alvo help e build do editor Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
4950ad6006
49 files changed
+10596
No files matched your search
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* TinyBlocks — tb_editor.h
|
||||
* Editor visual block-based (estilo Scratch) implementado como LibraryBlock.
|
||||
*
|
||||
* O editor é o próprio bloco "Editor.Scene": não abre janela nem processa
|
||||
* eventos SDL2 diretamente. Em vez disso:
|
||||
* - implementa on_draw, produzindo um TinyBlocks_RenderableBlock
|
||||
* - lê o estado de input/mouse/teclado a partir de um bloco SDL2.Events
|
||||
* conectado ao seu input "events"
|
||||
* - deve ser conectado ao input "scene" de um bloco SDL2.App, que é quem
|
||||
* de fato cria a janela, roda o loop e interpreta o RenderableBlock.
|
||||
*
|
||||
* Uso:
|
||||
* tb_library_register(rt, tb_editor_get_library());
|
||||
* tb_library_register(rt, tb_sdl2_get_library());
|
||||
*
|
||||
* TinyBlocks_Block* events = tb_block_create(rt, tb_type_block_find(rt,"SDL2.Events"));
|
||||
* TinyBlocks_Block* scene = tb_block_create(rt, tb_type_block_find(rt,"Editor.Scene"));
|
||||
* tb_block_set_default(scene, 0, tb_value_block(events));
|
||||
*
|
||||
* TinyBlocks_Block* app = tb_block_create(rt, tb_type_block_find(rt,"SDL2.App"));
|
||||
* tb_block_set_default(app, 3, tb_value_block(scene));
|
||||
* tb_block_set_default(app, 4, tb_value_block(events));
|
||||
* tb_block_eval(app, rt); // roda o loop principal — bloqueia até fechar
|
||||
*/
|
||||
#ifndef TINYBLOCKS_EDITOR_H
|
||||
#define TINYBLOCKS_EDITOR_H
|
||||
|
||||
#include <tinyblocks/tinyblocks.h>
|
||||
|
||||
TB_API const TinyBlocks_LibraryDescriptor* tb_editor_get_library(void);
|
||||
TB_API const TinyBlocks_LibraryDescriptor* tinyblocks_get_library(void);
|
||||
|
||||
/* Enfileira um .so para ser carregado automaticamente ao abrir o editor */
|
||||
TB_API void tb_editor_preload(const char* path);
|
||||
|
||||
#endif /* TINYBLOCKS_EDITOR_H */
|
||||
Reference in new issue
Block a user