- Música i só amb SDL_mixer
This commit is contained in:
54
lua.cpp
54
lua.cpp
@@ -649,14 +649,50 @@ extern "C" {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cpp_playchirp(lua_State *L) {
|
||||
static int cpp_playmusic(lua_State *L) {
|
||||
const char* str = luaL_checkstring(L, 1);
|
||||
playchirp(str);
|
||||
const int volume = luaL_optinteger(L, 2, -1);
|
||||
playmusic(str, volume);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_stopchirp(lua_State *L) {
|
||||
stopchirp();
|
||||
static int cpp_pausemusic(lua_State *L) {
|
||||
pausemusic();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_resumemusic(lua_State *L) {
|
||||
resumemusic();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_stopmusic(lua_State *L) {
|
||||
stopmusic();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_loadsound(lua_State *L) {
|
||||
const char* str = luaL_checkstring(L, 1);
|
||||
lua_pushinteger(L,loadsound(str));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cpp_freesound(lua_State *L) {
|
||||
const int sound = luaL_checknumber(L, 1);
|
||||
freesound(sound);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_playsound(lua_State *L) {
|
||||
const int sound = luaL_checknumber(L, 1);
|
||||
const int volume = luaL_optinteger(L, 2, -1);
|
||||
lua_pushinteger(L,playsound(sound, volume));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cpp_stopsound(lua_State *L) {
|
||||
const int sound = luaL_checknumber(L, 1);
|
||||
stopsound(sound);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -761,8 +797,14 @@ void push_lua_funcs() {
|
||||
lua_pushcfunction(L,cpp_freadw); lua_setglobal(L, "freadw");
|
||||
lua_pushcfunction(L,cpp_freadb); lua_setglobal(L, "freadb");
|
||||
|
||||
lua_pushcfunction(L,cpp_playchirp); lua_setglobal(L, "playchirp");
|
||||
lua_pushcfunction(L,cpp_stopchirp); lua_setglobal(L, "stopchirp");
|
||||
lua_pushcfunction(L,cpp_playmusic); lua_setglobal(L, "playmusic");
|
||||
lua_pushcfunction(L,cpp_pausemusic); lua_setglobal(L, "pausemusic");
|
||||
lua_pushcfunction(L,cpp_resumemusic); lua_setglobal(L, "resumemusic");
|
||||
lua_pushcfunction(L,cpp_stopmusic); lua_setglobal(L, "stopmusic");
|
||||
lua_pushcfunction(L,cpp_loadsound); lua_setglobal(L, "loadsound");
|
||||
lua_pushcfunction(L,cpp_freesound); lua_setglobal(L, "freesound");
|
||||
lua_pushcfunction(L,cpp_playsound); lua_setglobal(L, "playsound");
|
||||
lua_pushcfunction(L,cpp_stopsound); lua_setglobal(L, "stopsound");
|
||||
|
||||
lua_pushcfunction(L,cpp_exit); lua_setglobal(L, "quit");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user