[FEAT] Border
[FEAT] Color accepts a third optional parameter for border
This commit is contained in:
2021-12-10 19:32:05 +01:00
parent f21f199917
commit 376c15c272
3 changed files with 27 additions and 5 deletions

16
lua.cpp
View File

@@ -21,10 +21,21 @@ extern "C" {
return 0;
}
static int cpp_border(lua_State *L) {
uint8_t val = luaL_checkinteger(L, 1);
border(val);
return 0;
}
static int cpp_color(lua_State *L) {
uint8_t ink = luaL_checkinteger(L, 1);
uint8_t paper = luaL_checkinteger(L, 2);
color(ink, paper);
if (lua_gettop(L) > 2) {
uint8_t border = luaL_checkinteger(L, 3);
color(ink, paper, border);
} else {
color(ink, paper);
}
return 0;
}
@@ -274,7 +285,7 @@ bool lua_is_playing() {
return lua_state == STATE_PLAYING;
}
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.2',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(7)print('mini',9,8)ink(8)print('v0.5.4',34,29)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();
@@ -303,6 +314,7 @@ void lua_init(const char* filename, const bool start_playing) {
lua_pushcfunction(L,cpp_cls); lua_setglobal(L, "cls");
lua_pushcfunction(L,cpp_ink); lua_setglobal(L, "ink");
lua_pushcfunction(L,cpp_paper); lua_setglobal(L, "paper");
lua_pushcfunction(L,cpp_border); lua_setglobal(L, "border");
lua_pushcfunction(L,cpp_color); lua_setglobal(L, "color");
lua_pushcfunction(L,cpp_locate); lua_setglobal(L, "locate");