v0.5.2:
[FEAT] play(str) [FEAT] Chime on boot [FEAT] simple song example on 'game.lua'
This commit is contained in:
9
lua.cpp
9
lua.cpp
@@ -220,6 +220,12 @@ extern "C" {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_play(lua_State *L) {
|
||||
const char* str = luaL_optstring(L, 1, NULL);
|
||||
play(str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_setmode(lua_State *L) {
|
||||
int val = luaL_checkinteger(L, 1);
|
||||
setmode(val);
|
||||
@@ -268,7 +274,7 @@ bool lua_is_playing() {
|
||||
return lua_state == STATE_PLAYING;
|
||||
}
|
||||
|
||||
const char boot[] = "function init()setmode(1)cls()memcpy(360,4608,240)memcpy(1560,4848,240)ink(1)print('G A M E',8,16)ink(4)print('S Y S T E M',20,16)ink(8)print('v0.5.1',26,8)w=0 end function update()w=w+1 if w>90 then cls()load()end end";
|
||||
const char boot[] = "function init()setmode(1)cls()play('o5l0v5cegv4cegv3cegv2cegv1ceg')memcpy(360,4608,240)memcpy(1560,4848,240)ink(1)print('G A M E',8,16)ink(4)print('S Y S T E M',20,16)ink(8)print('v0.5.1',26,8)w=0 end function update()w=w+1 if w>90 then cls()load()end end";
|
||||
|
||||
void lua_init(const char* filename, const bool start_playing) {
|
||||
if (lua_state != STATE_STOPPED) lua_quit();
|
||||
@@ -335,6 +341,7 @@ void lua_init(const char* filename, const bool start_playing) {
|
||||
lua_pushcfunction(L,cpp_memcpy); lua_setglobal(L, "memcpy");
|
||||
lua_pushcfunction(L,cpp_sound); lua_setglobal(L, "sound");
|
||||
lua_pushcfunction(L,cpp_nosound); lua_setglobal(L, "nosound");
|
||||
lua_pushcfunction(L,cpp_play); lua_setglobal(L, "play");
|
||||
lua_pushcfunction(L,cpp_setmode); lua_setglobal(L, "setmode");
|
||||
lua_pushcfunction(L,cpp_load); lua_setglobal(L, "load");
|
||||
lua_pushcfunction(L,cpp_log); lua_setglobal(L, "log");
|
||||
|
||||
Reference in New Issue
Block a user