roleplay/client/include/ui_lua.h

75 lines
1.5 KiB
C

#ifndef UI_LUA_H
#define UI_LUA_H
#include "ui.h"
// Registers the `ui` global table and input constants in the Lua state
void ui_lua_register(lua_State* L);
// Loads a script into a sandboxed environment, stores the env ref in c->script_env
VkResult ui_lua_load_container(
lua_State* L,
Container* c,
UIContext* ui,
RenderContext* gpu,
const char* path);
// Called by the engine input path. Each returns true if the container's script
// defined the handler and it returned a truthy value (event consumed).
bool ui_lua_dispatch_button(
UIContext* ui,
RenderContext* gpu,
Container* c,
uint32_t layer,
uint32_t element,
float x,
float y,
int button,
int action,
int mods);
bool ui_lua_dispatch_cursor(
UIContext* ui,
RenderContext* gpu,
Container* c,
uint32_t layer,
uint32_t element,
float x,
float y);
bool ui_lua_dispatch_scroll(
UIContext* ui,
RenderContext* gpu,
Container* c,
uint32_t layer,
uint32_t element,
double x,
double y);
bool ui_lua_dispatch_key(
UIContext* ui,
RenderContext* gpu,
Container* c,
uint32_t layer,
uint32_t element,
int key,
int action,
int mods);
bool ui_lua_dispatch_text(
UIContext* ui,
RenderContext* gpu,
Container* c,
uint32_t layer,
uint32_t element,
unsigned int codepoint);
bool ui_lua_dispatch_deselect(
UIContext* ui,
RenderContext* gpu,
Container* c,
uint32_t layer,
uint32_t element);
#endif