/* * TinyBlocks - tb_events.c * Categoria "Eventos": blocos que iniciam scripts. A execução é conduzida * pelo editor (run_chain); aqui só registramos os tipos e a categoria. */ #include #include "tb_events.h" static void eval_noop(TinyBlocks_Block* self, TinyBlocks* rt) { (void)rt; self->dirty = false; } static bool events_init(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) { static const TinyBlocks_Category cat = { "Eventos", {255/255.f, 191/255.f, 0/255.f, 1.f}, {204/255.f, 153/255.f, 0/255.f, 1.f}, }; tb_library_set_category(lib, &cat); TinyBlocks_TypeBlock* t = tb_type_block_create(rt, "Events.WhenRun", NULL, 0, NULL, 0, eval_noop); if (!t) return false; tb_type_block_set_event(t, TB_EVENT_FLAG); /* chapeu da bandeira verde */ return tb_library_add(lib, &t->base); } static void events_deinit(TinyBlocks* rt, TinyBlocks_LibraryBlock* lib) { (void)rt; (void)lib; } TINYBLOCKS_DEFINE_LIBRARY(events, "tinyblocks-events", "1.0.0", events_init, events_deinit) const TinyBlocks_LibraryDescriptor* tb_events_get_library(void) { return &_tb_lib_desc_events; }