VERSIÓ 1.3

- [NEW] shader.init(), shader.enable i shader.disable
- [NEW] Deixe els shaders de Lynx i GBC de exemple.
- [NEW] file_getfilebuffer() ara soporta un tercer paràmetre opcional, per a 'zeroterminar' el buffer per si es un arxiu de text.
This commit is contained in:
2025-06-18 19:29:17 +02:00
parent 79781bbed1
commit e1d5eb051c
14 changed files with 213 additions and 67 deletions

27
lua.cpp
View File

@@ -527,6 +527,27 @@ extern "C" {
}
// shaders
// ===============================================
static int cpp_shader_init(lua_State *L) {
const char* vstr = luaL_optstring(L, 1, NULL);
const char* fstr = luaL_optstring(L, 2, NULL);
shader_init(vstr, fstr);
return 0;
}
static int cpp_shader_enable(lua_State *L) {
shader_enable();
return 0;
}
static int cpp_shader_disable(lua_State *L) {
shader_disable();
return 0;
}
// music
// ===============================================
@@ -875,6 +896,12 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_draw_text); lua_setfield(L, -2, "text");
lua_setglobal(L, "draw");
lua_newtable(L);
lua_pushcfunction(L,cpp_shader_init); lua_setfield(L, -2, "init");
lua_pushcfunction(L,cpp_shader_enable); lua_setfield(L, -2, "enable");
lua_pushcfunction(L,cpp_shader_disable); lua_setfield(L, -2, "disable");
lua_setglobal(L, "shader");
lua_newtable(L);
lua_pushcfunction(L,cpp_music_play); lua_setfield(L, -2, "play");
lua_pushcfunction(L,cpp_music_pause); lua_setfield(L, -2, "pause");