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
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* TinyBlocks — tb_editor.h
|
||||
* 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
|
||||
@@ -21,7 +21,7 @@
|
||||
* 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
|
||||
* tb_block_eval(app, rt); // roda o loop principal - bloqueia até fechar
|
||||
*/
|
||||
#ifndef TINYBLOCKS_EDITOR_H
|
||||
#define TINYBLOCKS_EDITOR_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* TinyBlocks — tb_graphics.h
|
||||
* TinyBlocks - tb_graphics.h
|
||||
* Interface gráfica do TinyBlocks: janelas, entrada, desenho e texto.
|
||||
*
|
||||
* Tudo o que é gráfico passa por aqui antes de chegar a um backend concreto.
|
||||
@@ -9,15 +9,15 @@
|
||||
* - dinamicamente: tb_graphics_load_backend("build/libtinyblocks-sdl2.so");
|
||||
* (o .so exporta TINYBLOCKS_GRAPHICS_BACKEND_SYMBOL)
|
||||
* Sem escolha explícita usa o backend padrão de compilação (SDL2) ou, na
|
||||
* falta dele, o backend nulo (headless — útil para testes).
|
||||
* falta dele, o backend nulo (headless - útil para testes).
|
||||
*
|
||||
* TypeBlocks registrados por tb_graphics_get_library():
|
||||
* Graphics.Input — estado de entrada de uma janela no frame (outputs GFX_IN_*)
|
||||
* Graphics.Window — uma janela do SO que mostra uma cena (qualquer bloco com on_draw)
|
||||
* Graphics.Input - estado de entrada de uma janela no frame (outputs GFX_IN_*)
|
||||
* Graphics.Window - uma janela do SO que mostra uma cena (qualquer bloco com on_draw)
|
||||
* in: título, largura, altura, cena(block), entrada(block), principal(int)
|
||||
* Graphics.Run — roda o loop até a janela principal fechar
|
||||
* Graphics.Run - roda o loop até a janela principal fechar
|
||||
*
|
||||
* Esta library não conhece nenhum consumidor (editor, palco…): só define o
|
||||
* Esta library não conhece nenhum consumidor (editor, palco...): só define o
|
||||
* contrato e despacha para o backend. Cenas são quaisquer blocos com on_draw.
|
||||
*
|
||||
* Uso típico (host):
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <tinyblocks/tinyblocks.h>
|
||||
#include <tinyblocks/tb_renderable_block.h>
|
||||
|
||||
/* ── Teclas (neutras; o backend traduz as suas) ──────────────────────────── */
|
||||
/* -- Teclas (neutras; o backend traduz as suas) --- */
|
||||
enum {
|
||||
TB_KEY_NONE = 0,
|
||||
TB_KEY_ESCAPE, TB_KEY_RETURN, TB_KEY_BACKSPACE, TB_KEY_DELETE, TB_KEY_TAB,
|
||||
@@ -48,12 +48,12 @@ enum {
|
||||
TB_KEY_OTHER = 127
|
||||
};
|
||||
|
||||
/* ── Modificadores (bitmask) ─────────────────────────────────────────────── */
|
||||
/* -- Modificadores (bitmask) --- */
|
||||
#define TB_MOD_SHIFT 0x1
|
||||
#define TB_MOD_CTRL 0x2
|
||||
#define TB_MOD_ALT 0x4
|
||||
|
||||
/* ── Índices de output do bloco Graphics.Input ───────────────────────────── */
|
||||
/* -- Índices de output do bloco Graphics.Input --- */
|
||||
#define GFX_IN_MOUSE_X 0 /* real: posição X do mouse na janela */
|
||||
#define GFX_IN_MOUSE_Y 1 /* real: posição Y do mouse na janela */
|
||||
#define GFX_IN_MOUSE_L_HELD 2 /* int: botão esquerdo pressionado (estado) */
|
||||
@@ -89,7 +89,7 @@ typedef struct TinyBlocks_GfxInput {
|
||||
int mod_state;
|
||||
} TinyBlocks_GfxInput;
|
||||
|
||||
/* ── Contrato de um backend gráfico ──────────────────────────────────────── */
|
||||
/* -- Contrato de um backend gráfico --- */
|
||||
typedef struct TinyBlocks_GraphicsBackend {
|
||||
const char* name;
|
||||
bool (*init)(void); /* idempotente */
|
||||
@@ -107,7 +107,7 @@ typedef struct TinyBlocks_GraphicsBackend {
|
||||
#define TINYBLOCKS_GRAPHICS_BACKEND_SYMBOL "tinyblocks_get_graphics_backend"
|
||||
typedef const TinyBlocks_GraphicsBackend* (*TinyBlocks_GetGraphicsBackendFn)(void);
|
||||
|
||||
/* ── API ─────────────────────────────────────────────────────────────────── */
|
||||
/* -- API --- */
|
||||
TB_API const TinyBlocks_LibraryDescriptor* tb_graphics_get_library(void);
|
||||
|
||||
/* Escolhe o backend (antes de abrir a primeira janela) */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* TinyBlocks — tb_graphics.c
|
||||
* TinyBlocks - tb_graphics.c
|
||||
* Interface gráfica: escolha de backend, janelas, entrada e loop principal.
|
||||
*/
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
@@ -15,9 +15,9 @@
|
||||
#include <tb_sdl2.h>
|
||||
#endif
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Backend nulo (headless): janelas sem tela, entrada vazia, texto estimado
|
||||
* ══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
typedef struct { int w, h; } NullWin;
|
||||
|
||||
static bool null_init(void) { return true; }
|
||||
@@ -52,9 +52,9 @@ static const TinyBlocks_GraphicsBackend s_null_backend = {
|
||||
|
||||
const TinyBlocks_GraphicsBackend* tb_graphics_null_backend(void) { return &s_null_backend; }
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Escolha do backend
|
||||
* ══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
static const TinyBlocks_GraphicsBackend* s_backend = NULL;
|
||||
static bool s_backend_ready = false;
|
||||
static void* s_backend_dl = NULL;
|
||||
@@ -120,11 +120,11 @@ bool tb_graphics_load_backend(const char* so_path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Medição de texto
|
||||
* ══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
|
||||
/* Larguras de avanço da DejaVu Sans, em em, para ASCII 32..126 — estimativa
|
||||
/* Larguras de avanço da DejaVu Sans, em em, para ASCII 32..126 - estimativa
|
||||
* usada quando o backend não sabe medir (ex: backend nulo). */
|
||||
static const float s_adv[95] = {
|
||||
.318f,.401f,.460f,.838f,.636f,.950f,.780f,.275f,.390f,.390f,.500f,.838f,.318f,.361f,.318f,.337f,
|
||||
@@ -150,9 +150,9 @@ float tb_graphics_measure_text(const char* text, float font_size) {
|
||||
return b->measure_text ? b->measure_text(text, font_size) : estimate_text(text, font_size);
|
||||
}
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
* Graphics.Input — estado de entrada de uma janela no frame
|
||||
* ══════════════════════════════════════════════════════════════════════════ */
|
||||
/* ===
|
||||
* Graphics.Input - estado de entrada de uma janela no frame
|
||||
* === */
|
||||
static const TinyBlocks_SlotDesc s_input_outs[GFX_IN_COUNT] = {
|
||||
{"mouse_x", TB_VALUE_REAL}, {"mouse_y", TB_VALUE_REAL},
|
||||
{"l_held", TB_VALUE_INTEGER}, {"r_held", TB_VALUE_INTEGER},
|
||||
@@ -206,12 +206,12 @@ static void input_push(TinyBlocks_Block* b, const TinyBlocks_GfxInput* in) {
|
||||
b->dirty = false;
|
||||
}
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
* Graphics.Window — uma janela do SO mostrando uma cena
|
||||
/* ===
|
||||
* Graphics.Window - uma janela do SO mostrando uma cena
|
||||
* inputs: 0 título, 1 largura, 2 altura, 3 cena(block), 4 entrada(block),
|
||||
* 5 principal(int: fechar esta janela encerra o loop; padrão 1)
|
||||
* output: 0 aberta(int)
|
||||
* ══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
typedef struct { void* handle; uint64_t id; bool open; } WinState;
|
||||
|
||||
static int win_find(uint64_t id) {
|
||||
@@ -275,9 +275,9 @@ bool tb_graphics_window_is_open(TinyBlocks_Block* window) {
|
||||
return ((WinState*)window->userdata)->open;
|
||||
}
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Loop principal
|
||||
* ══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
static void default_wait(void) {
|
||||
struct timespec ts = { 0, 16 * 1000000L };
|
||||
nanosleep(&ts, NULL);
|
||||
@@ -340,9 +340,9 @@ static void eval_run(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
tb_graphics_run(rt);
|
||||
}
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Registro da library
|
||||
* ══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
static bool graphics_lib_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
TinyBlocks_TypeBlock* t;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
* tb_mcp — cliente MCP (Model Context Protocol) sobre transporte HTTP
|
||||
* tb_mcp - cliente MCP (Model Context Protocol) sobre transporte HTTP
|
||||
* e stdio, implementado em Python via tinyblocks-python.
|
||||
*
|
||||
* Transport HTTP (streamable): url = "http://host:port/mcp"
|
||||
@@ -22,15 +22,15 @@
|
||||
TB_MCP_API bool tb_mcp_init(void);
|
||||
TB_MCP_API void tb_mcp_deinit(void);
|
||||
|
||||
/* Lista ferramentas disponíveis → JSON array de objetos {name, description} */
|
||||
/* Lista ferramentas disponíveis -> JSON array de objetos {name, description} */
|
||||
TB_MCP_API char* tb_mcp_list_tools(const char* url);
|
||||
|
||||
/* Chama uma ferramenta com argumentos JSON → resultado JSON */
|
||||
/* Chama uma ferramenta com argumentos JSON -> resultado JSON */
|
||||
TB_MCP_API char* tb_mcp_call_tool(const char* url,
|
||||
const char* tool_name,
|
||||
const char* args_json);
|
||||
|
||||
/* Ping: verifica se o servidor responde → "ok" ou mensagem de erro */
|
||||
/* Ping: verifica se o servidor responde -> "ok" ou mensagem de erro */
|
||||
TB_MCP_API char* tb_mcp_ping(const char* url);
|
||||
|
||||
#endif /* TINYBLOCKS_MCP_H */
|
||||
@@ -9,7 +9,7 @@
|
||||
/* Código Python gerado por: xxd -i tb_mcp.py > tb_mcp_py.h */
|
||||
#include "tb_mcp_py.h"
|
||||
|
||||
/* ── Singleton ───────────────────────────────────────────────────────────── */
|
||||
/* -- Singleton --- */
|
||||
static bool s_module_loaded = false;
|
||||
|
||||
static bool ensure_module(void) {
|
||||
@@ -36,7 +36,7 @@ TB_MCP_API void tb_mcp_deinit(void) {
|
||||
tb_python_deinit();
|
||||
}
|
||||
|
||||
/* ── Helper: escapa string para literal Python ───────────────────────────── */
|
||||
/* -- Helper: escapa string para literal Python --- */
|
||||
static char* py_str(const char* s) {
|
||||
size_t n = strlen(s);
|
||||
char* out = malloc(n * 4 + 3);
|
||||
@@ -60,7 +60,7 @@ static char* py_str(const char* s) {
|
||||
return out;
|
||||
}
|
||||
|
||||
/* ── Helper genérico: monta e executa chamada Python fn(arg...) ─────────── */
|
||||
/* -- Helper genérico: monta e executa chamada Python fn(arg...) --- */
|
||||
static char* py_call(const char* fn, const char* const* args, int n) {
|
||||
if (!ensure_module()) return strdup("erro: modulo MCP nao carregado");
|
||||
|
||||
@@ -108,7 +108,7 @@ static char* py_call(const char* fn, const char* const* args, int n) {
|
||||
return out ? out : strdup("");
|
||||
}
|
||||
|
||||
/* ── API pública ─────────────────────────────────────────────────────────── */
|
||||
/* -- API pública --- */
|
||||
TB_MCP_API char* tb_mcp_ping(const char* url) {
|
||||
const char* args[] = {url};
|
||||
return py_call("mcp_ping", args, 1);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#endif
|
||||
|
||||
/*
|
||||
* tb_python — wrapper fino sobre o interpretador CPython embutido.
|
||||
* tb_python - wrapper fino sobre o interpretador CPython embutido.
|
||||
*
|
||||
* O interpretador é compartilhado em todo o processo (singleton ref-counted).
|
||||
* Compile a lib como .so compartilhada para que python.so e mcp.so usem o
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "tinyblocks-python/tb_python.h"
|
||||
|
||||
/* ── Singleton ref-counted ───────────────────────────────────────────────── */
|
||||
/* -- Singleton ref-counted --- */
|
||||
static int s_refs = 0;
|
||||
|
||||
TB_PYTHON_API bool tb_python_init(void) {
|
||||
@@ -30,7 +30,7 @@ TB_PYTHON_API void tb_python_deinit(void) {
|
||||
Py_FinalizeEx();
|
||||
}
|
||||
|
||||
/* ── Helper: captura stdout+stderr de uma execução ──────────────────────── */
|
||||
/* -- Helper: captura stdout+stderr de uma execução --- */
|
||||
static char* capture_run(const char* code, PyObject* local_dict) {
|
||||
/* StringIO para capturar output */
|
||||
PyObject* io = PyImport_ImportModule("io");
|
||||
@@ -72,7 +72,7 @@ static char* capture_run(const char* code, PyObject* local_dict) {
|
||||
return out;
|
||||
}
|
||||
|
||||
/* ── API pública ─────────────────────────────────────────────────────────── */
|
||||
/* -- API pública --- */
|
||||
TB_PYTHON_API char* tb_python_run(const char* code) {
|
||||
if (!code || !Py_IsInitialized()) return strdup("");
|
||||
return capture_run(code, NULL);
|
||||
@@ -95,7 +95,7 @@ TB_PYTHON_API char* tb_python_exec_main(const char* code) {
|
||||
PyObject_SetAttrString(sys, "stdout", buf);
|
||||
PyObject_SetAttrString(sys, "stderr", buf);
|
||||
|
||||
/* Executa com main_dict como globals E locals — definições persistem */
|
||||
/* Executa com main_dict como globals E locals - definições persistem */
|
||||
PyObject* result = PyRun_String(code, Py_file_input, main_dict, main_dict);
|
||||
if (!result) { PyErr_Print(); PyErr_Clear(); }
|
||||
Py_XDECREF(result);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* TinyBlocks — tb_sdl2.h
|
||||
* TinyBlocks - tb_sdl2.h
|
||||
*
|
||||
* TypeBlocks disponíveis após registrar esta library:
|
||||
*
|
||||
* SDL2.Events — expõe o estado de eventos do frame corrente (sem inputs;
|
||||
* SDL2.Events - expõe o estado de eventos do frame corrente (sem inputs;
|
||||
* outputs pré-preenchidos pelo SDL2.App antes de cada on_draw)
|
||||
*
|
||||
* SDL2.App — cria janela, roda o loop principal, chama on_draw na scene.
|
||||
* SDL2.App - cria janela, roda o loop principal, chama on_draw na scene.
|
||||
* in: title(text), w(int), h(int), scene(block), events(block)
|
||||
*
|
||||
* Blocos primitivos (uso manual):
|
||||
@@ -30,7 +30,7 @@ TB_API const TinyBlocks_LibraryDescriptor* tinyblocks_get_library(void);
|
||||
struct TinyBlocks_GraphicsBackend;
|
||||
TB_API const struct TinyBlocks_GraphicsBackend* tb_sdl2_graphics_backend(void);
|
||||
|
||||
/* ── Índices de output do bloco SDL2.Events ──────────────────────────────── */
|
||||
/* -- Índices de output do bloco SDL2.Events --- */
|
||||
#define SDL2_EV_MOUSE_X 0 /* real: posição X do mouse */
|
||||
#define SDL2_EV_MOUSE_Y 1 /* real: posição Y do mouse */
|
||||
#define SDL2_EV_MOUSE_L_HELD 2 /* int: botão esquerdo pressionado (estado) */
|
||||
@@ -52,7 +52,7 @@ TB_API const struct TinyBlocks_GraphicsBackend* tb_sdl2_graphics_backend(void);
|
||||
#define SDL2_EV_MOD_STATE 18 /* int: SDL_GetModState() deste frame */
|
||||
#define SDL2_EV_COUNT 19 /* total de outputs */
|
||||
|
||||
/* ── Constantes de tipo de evento (SDL2.PollEvent legado) ───────────────── */
|
||||
/* -- Constantes de tipo de evento (SDL2.PollEvent legado) --- */
|
||||
#define TB_SDL2_EVENT_NONE 0
|
||||
#define TB_SDL2_EVENT_QUIT 256
|
||||
#define TB_SDL2_EVENT_KEYDOWN 768
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* TinyBlocks — tb_sdl2.c
|
||||
* TinyBlocks - tb_sdl2.c
|
||||
* Backend SDL2 para TinyBlocks.
|
||||
*
|
||||
* Blocos principais:
|
||||
* SDL2.Events — snapshot de eventos do frame, pré-preenchido pelo SDL2.App
|
||||
* SDL2.App — janela + renderer + loop principal + executor de renderables
|
||||
* SDL2.Events - snapshot de eventos do frame, pré-preenchido pelo SDL2.App
|
||||
* SDL2.App - janela + renderer + loop principal + executor de renderables
|
||||
*
|
||||
* Blocos primitivos legados: Init, Quit, Window, Renderer, etc.
|
||||
*
|
||||
* Também implementa o contrato TinyBlocks_GraphicsBackend da interface
|
||||
* tinyblocks-graphics (várias janelas, entrada por janela, desenho com AA e
|
||||
* medição de texto com a fonte real) — ver tb_sdl2_graphics_backend().
|
||||
* medição de texto com a fonte real) - ver tb_sdl2_graphics_backend().
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
@@ -27,9 +27,9 @@
|
||||
#include <tb_graphics.h>
|
||||
#include "../include/tb_sdl2.h"
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Handles opacos de Window/Renderer (blocos wrapper)
|
||||
* ═══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
static TinyBlocks_TypeBlock* s_type_window_handle = NULL;
|
||||
static TinyBlocks_TypeBlock* s_type_renderer_handle = NULL;
|
||||
|
||||
@@ -44,9 +44,9 @@ static void eval_handle_noop(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
(void)self; (void)rt;
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════════════
|
||||
* Fonte TTF — cache por tamanho
|
||||
* ═══════════════════════════════════════════════════════════════════════════ */
|
||||
/* ===
|
||||
* Fonte TTF - cache por tamanho
|
||||
* === */
|
||||
#define FONT_CACHE_CAP 8
|
||||
#define FONT_SEARCH_COUNT 6
|
||||
|
||||
@@ -88,11 +88,11 @@ static void fonts_close_all(void) {
|
||||
s_font_cache_n = 0;
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Executor de TinyBlocks_RenderableBlock via SDL2
|
||||
* ═══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
|
||||
/* ── Rasterização com antialias ─────────────────────────────────────────────
|
||||
/* -- Rasterização com antialias ---
|
||||
* As formas preenchidas são varridas linha a linha com AA_SUB sub-linhas por
|
||||
* pixel e cobertura horizontal exata. Cada pixel é pintado uma única vez, com
|
||||
* alpha proporcional à cobertura: bordas suavizadas e sem overdraw (cores
|
||||
@@ -349,9 +349,9 @@ static void sdl2_execute(SDL_Renderer* ren,
|
||||
}
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Backend da interface tinyblocks-graphics
|
||||
* ═══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
typedef struct SdlWin {
|
||||
SDL_Window* win;
|
||||
SDL_Renderer* ren;
|
||||
@@ -586,9 +586,9 @@ const TinyBlocks_GraphicsBackend* tinyblocks_get_graphics_backend(void) {
|
||||
return &s_sdl2_backend;
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════════════
|
||||
* SDL2.Events — snapshot de eventos do frame
|
||||
* ═══════════════════════════════════════════════════════════════════════════ */
|
||||
/* ===
|
||||
* SDL2.Events - snapshot de eventos do frame
|
||||
* === */
|
||||
static void eval_sdl2_events(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
(void)rt;
|
||||
/* Outputs são pré-preenchidos pelo SDL2.App antes de cada frame.
|
||||
@@ -658,9 +658,9 @@ static void events_push(TinyBlocks_Block* ev, const FrameEvents* fe) {
|
||||
ev->dirty = false;
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════════════
|
||||
* SDL2.App — janela + loop principal
|
||||
* ═══════════════════════════════════════════════════════════════════════════ */
|
||||
/* ===
|
||||
* SDL2.App - janela + loop principal
|
||||
* === */
|
||||
typedef struct {
|
||||
SDL_Window* win;
|
||||
SDL_Renderer* ren;
|
||||
@@ -824,9 +824,9 @@ static void eval_sdl2_app(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
self->dirty = false;
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Blocos primitivos legados
|
||||
* ═══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
static void eval_sdl2_init(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
(void)self;
|
||||
if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_EVENTS) != 0)
|
||||
@@ -936,9 +936,9 @@ static void eval_sdl2_poll_event(TinyBlocks_Block* self, TinyBlocks* rt) {
|
||||
}
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════════════════════════
|
||||
/* ===
|
||||
* Registro da library
|
||||
* ═══════════════════════════════════════════════════════════════════════════ */
|
||||
* === */
|
||||
static bool sdl2_lib_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) {
|
||||
s_type_window_handle = tb_type_block_create(rt, "SDL2._WindowHandle",
|
||||
NULL,0,NULL,0, eval_handle_noop);
|
||||
|
||||
Reference in new issue
Block a user