Editor: animacoes M3, compartilhar/receber blocos por QR e ver codigo-fonte
- Animacoes (curvas do M3): blocos criados por codigo surgem em cascata, apagados saem de cena (fantasma que encolhe), os de baixo deslizam ao mudar de lugar na pilha; rolagem e zoom suaves. TINYBLOCKS_REDUCE_MOTION=1 desliga (o harness usa). Texto respeita a opacidade no backend SDL2. - Botao direito: "Ver codigo-fonte" (funcao C do bloco na aba de codigo), "Compartilhar pilha/blueprint (QR)" (scratchblocks em partes de 220 bytes, "TB1|id|parte|total|", em loop de 1 s) e "Receber blocos (QR)" (camera, partes em qualquer ordem, importa onde clicou). - tinyblocks-qr: qrcodegen (MIT) + quirc (ISC) e camera em cinza: V4L2 no Linux, Camera2 do NDK no Android (sem Java), nada no Windows. - Captura de desenvolvimento: TINYBLOCKS_SHOT_COUNT/STEP salvam sequencias. - Testes: test-qr (ida e volta) e harness cenario 35. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
70c819393c
commit
4f6a68c22c
31 files changed
+5789
-49
No files matched your search
@@ -552,6 +552,20 @@ typedef struct {
|
||||
float x, w;
|
||||
} Part;
|
||||
|
||||
/* Rolagem animada: de `from` a `to` a partir de t0 (curva standard do M3) */
|
||||
typedef struct { bool on; float from, to; unsigned t0; } ScrollAnim;
|
||||
|
||||
/* Bloco apagado saindo de cena: os comandos de desenho dele (na tela) */
|
||||
#define GHOST_MAX 8
|
||||
typedef struct {
|
||||
TinyBlocks_DrawCmd* cmds;
|
||||
int n;
|
||||
float cx, cy;
|
||||
unsigned t0;
|
||||
bool clip;
|
||||
float clip_r[4];
|
||||
} Ghost;
|
||||
|
||||
typedef struct {
|
||||
bool used;
|
||||
bool dragging;
|
||||
@@ -586,6 +600,13 @@ typedef struct {
|
||||
const void* jst_T;
|
||||
int jst_bi, jst_depth;
|
||||
uint32_t jst_gen;
|
||||
/* animacao: deslize ao mudar de lugar na pilha (offset que vai a zero) e
|
||||
surgir (blocos criados por codigo); l_* = o ultimo layout visto */
|
||||
float an_dx, an_dy;
|
||||
unsigned an_t0, ap_t0;
|
||||
bool l_ok;
|
||||
int l_root;
|
||||
float l_x, l_y, l_rx, l_ry;
|
||||
} EdBlock;
|
||||
|
||||
/* Um trecho colorido do editor de codigo (vindo do tinyblocks-syntax). */
|
||||
@@ -690,7 +711,8 @@ typedef enum { SN_NONE, SN_NEXT, SN_SUB, SN_ABOVE, SN_ARG, SN_STACK } SnapKind;
|
||||
enum { CM_DUPLICATE, CM_DELETE, CM_EDIT_DEF, CM_CLEANUP, CM_NEW_COMPOSITE,
|
||||
CM_EXP_JSON, CM_EXP_XML, CM_EXP_CSV, CM_EXP_SB, CM_PASTE_SB,
|
||||
CM_GROUP_NEW, CM_GROUP_STACK, CM_GROUP_RENAME, CM_GROUP_COLOR, CM_GROUP_DELETE,
|
||||
CM_MB_OPEN, CM_MB_SAVE, CM_MB_EXPORT, CM_MB_LIBMAN, CM_MB_LIB, CM_MB_CFG };
|
||||
CM_MB_OPEN, CM_MB_SAVE, CM_MB_EXPORT, CM_MB_LIBMAN, CM_MB_LIB, CM_MB_CFG,
|
||||
CM_SOURCE, CM_SHARE_STACK, CM_SHARE_TAB, CM_RECEIVE };
|
||||
|
||||
/* Modos da barra de caminho do menu (path_input) */
|
||||
enum { PM_NONE, PM_LIB, PM_LOAD, PM_SAVE, PM_EXP_JSON, PM_EXP_XML, PM_EXP_CSV,
|
||||
@@ -1048,6 +1070,35 @@ typedef struct Ed {
|
||||
/* Servidor MCP: agentes leem e editam as pilhas por ferramentas */
|
||||
struct TbMcpServer* mcp;
|
||||
|
||||
/* Animacoes (curvas do M3). anim_off: TINYBLOCKS_REDUCE_MOTION=1 (e os
|
||||
testes): tudo vai direto ao fim */
|
||||
unsigned t_ms; /* relogio do quadro */
|
||||
bool anim_off;
|
||||
bool appear_batch; /* blocos criados agora surgem animados */
|
||||
int appear_k; /* ordem dentro do lote (cascata) */
|
||||
ScrollAnim sa_ws_x, sa_ws_y, sa_fly, sa_cat, sa_lm, sa_st;
|
||||
int sa_ws_tab;
|
||||
struct { bool on; float from, to, ax, ay; unsigned t0; int tab; } za; /* zoom */
|
||||
Ghost ghosts[GHOST_MAX]; /* blocos apagados saindo de cena */
|
||||
int ghost_n;
|
||||
|
||||
/* QR: compartilhar (painel com os QR em loop, 1 s cada) e receber (camera) */
|
||||
bool qrs_open;
|
||||
char* qrs_text; /* scratchblocks inteiro */
|
||||
int qrs_n; /* quantas partes */
|
||||
unsigned qrs_t0;
|
||||
char qrs_id[8];
|
||||
char qrs_title[64];
|
||||
bool qrr_open, qrr_cam;
|
||||
struct TbQrReader* qrr_reader;
|
||||
unsigned char* qrr_gray;
|
||||
TinyBlocks_Image* qrr_img; /* previa da camera */
|
||||
char qrr_id[8];
|
||||
int qrr_n, qrr_got;
|
||||
char** qrr_part;
|
||||
float qrr_x, qrr_y; /* onde os blocos recebidos entram */
|
||||
char qrr_msg[200];
|
||||
|
||||
/* Edicao de texto (te_*): o campo em edicao tem cursor e selecao; o
|
||||
editor de codigo tem os dele (code_caret/code_anchor). Alcas e barra
|
||||
de acoes (toque) servem aos dois (te_owner). */
|
||||
@@ -1090,6 +1141,8 @@ static Ed* g_active_ed TB_EW_UNUSED = NULL;
|
||||
void bubble_clear(Ed* ed);
|
||||
|
||||
void palette_rebuild(Ed* ed);
|
||||
/* Bloco (ou a pilha a partir dele) saindo de cena: fantasma animado */
|
||||
void ghost_capture(Ed* ed, Tab* T, int bi, bool chain, float wsx, float wsy, bool clip);
|
||||
void utf8_pop(char* s);
|
||||
void append_text(char* dst, size_t cap, const char* add);
|
||||
/* Campo de texto em edicao (cursor, selecao, Ctrl+A/C/X/V): as teclas e o
|
||||
|
||||
Reference in new issue
Block a user