/* * 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; * outputs pré-preenchidos pelo SDL2.App antes de cada on_draw) * * 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): * SDL2.Init / SDL2.Quit * SDL2.Window / SDL2.DestroyWindow * SDL2.Renderer / SDL2.DestroyRenderer * SDL2.SetDrawColor / SDL2.Clear / SDL2.FillRect / SDL2.DrawRect * SDL2.Present / SDL2.Delay / SDL2.PollEvent */ #ifndef TINYBLOCKS_SDL2_H #define TINYBLOCKS_SDL2_H #include TB_API const TinyBlocks_LibraryDescriptor* tb_sdl2_get_library(void); TB_API const TinyBlocks_LibraryDescriptor* tinyblocks_get_library(void); /* Implementação do contrato de backend da interface tinyblocks-graphics * (struct definida em tb_graphics.h; declarada aqui só por nome para que * quem usa os blocos SDL2.* não precise do header da interface). */ struct TinyBlocks_GraphicsBackend; TB_API const struct TinyBlocks_GraphicsBackend* tb_sdl2_graphics_backend(void); /* ── Í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) */ #define SDL2_EV_MOUSE_R_HELD 3 /* int: botão direito pressionado (estado) */ #define SDL2_EV_MOUSE_L_DOWN 4 /* int: 1 se pressionado neste frame */ #define SDL2_EV_MOUSE_L_UP 5 /* int: 1 se solto neste frame */ #define SDL2_EV_MOUSE_R_DOWN 6 /* int: 1 se pressionado neste frame */ #define SDL2_EV_MOUSE_R_UP 7 /* int: 1 se solto neste frame */ #define SDL2_EV_SCROLL_DY 8 /* real: scroll vertical deste frame */ #define SDL2_EV_KEY_SCANCODE 9 /* int: SDL_Scancode da tecla pressionada */ #define SDL2_EV_KEY_MOD 10 /* int: SDL_Keymod (KMOD_CTRL etc.) */ #define SDL2_EV_KEY_REPEAT 11 /* int: 1 se é repeat de key held */ #define SDL2_EV_TEXT_INPUT 12 /* text: texto digitado neste frame */ #define SDL2_EV_QUIT 13 /* int: 1 se janela foi fechada */ #define SDL2_EV_WIN_W 14 /* int: largura atual da janela */ #define SDL2_EV_WIN_H 15 /* int: altura atual da janela */ #define SDL2_EV_DROP_FILE 16 /* text: caminho de arquivo arrastado */ #define SDL2_EV_SCROLL_DX 17 /* real: scroll horizontal deste frame */ #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) ───────────────── */ #define TB_SDL2_EVENT_NONE 0 #define TB_SDL2_EVENT_QUIT 256 #define TB_SDL2_EVENT_KEYDOWN 768 #define TB_SDL2_EVENT_KEYUP 769 #endif /* TINYBLOCKS_SDL2_H */