VERSIÓ 1.3.7
- [NEW] music.enable() i sound.enable()
This commit is contained in:
22
lua.cpp
22
lua.cpp
@@ -584,6 +584,16 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
static int cpp_music_enable(lua_State *L) {
|
||||
if (lua_gettop(L) == 0) {
|
||||
lua_pushboolean(L, ismusicenabled());
|
||||
return 1;
|
||||
} else {
|
||||
enablemusic(lua_toboolean(L, 1));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sound
|
||||
// ===============================================
|
||||
@@ -613,6 +623,16 @@ extern "C" {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_sound_enable(lua_State *L) {
|
||||
if (lua_gettop(L) == 0) {
|
||||
lua_pushboolean(L, issoundenabled());
|
||||
return 1;
|
||||
} else {
|
||||
enablesound(lua_toboolean(L, 1));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sys
|
||||
// ===============================================
|
||||
@@ -913,6 +933,7 @@ void push_lua_funcs() {
|
||||
lua_pushcfunction(L,cpp_music_resume); lua_setfield(L, -2, "resume");
|
||||
lua_pushcfunction(L,cpp_music_stop); lua_setfield(L, -2, "stop");
|
||||
lua_pushcfunction(L,cpp_music_pos); lua_setfield(L, -2, "pos");
|
||||
lua_pushcfunction(L,cpp_music_enable); lua_setfield(L, -2, "enabled");
|
||||
lua_setglobal(L, "music");
|
||||
|
||||
lua_newtable(L);
|
||||
@@ -920,6 +941,7 @@ void push_lua_funcs() {
|
||||
lua_pushcfunction(L,cpp_sound_free); lua_setfield(L, -2, "free");
|
||||
lua_pushcfunction(L,cpp_sound_play); lua_setfield(L, -2, "play");
|
||||
lua_pushcfunction(L,cpp_sound_stop); lua_setfield(L, -2, "stop");
|
||||
lua_pushcfunction(L,cpp_sound_enable); lua_setfield(L, -2, "enabled");
|
||||
lua_setglobal(L, "sound");
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
Reference in New Issue
Block a user