- WIP
This commit is contained in:
61
lua.cpp
61
lua.cpp
@@ -161,14 +161,14 @@ extern "C" {
|
||||
}
|
||||
|
||||
static int cpp_map_draw(lua_State *L) {
|
||||
uint8_t celx = luaL_checknumber(L, 1);
|
||||
/*uint8_t celx = luaL_checknumber(L, 1);
|
||||
uint8_t cely = luaL_checknumber(L, 2);
|
||||
int sx = luaL_checknumber(L, 3);
|
||||
int sy = luaL_checknumber(L, 4);
|
||||
uint8_t celw = luaL_checknumber(L, 5);
|
||||
uint8_t celh = luaL_checknumber(L, 6);
|
||||
uint8_t layer = luaL_optinteger(L, 7, 0);
|
||||
map(celx, cely, sx, sy, celw, celh, layer);
|
||||
uint8_t layer = luaL_optinteger(L, 7, 0);*/
|
||||
map(); //celx, cely, sx, sy, celw, celh, layer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -626,14 +626,19 @@ extern "C" {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cpp_sys_setTurbo(lua_State *L) {
|
||||
if (lua_gettop(L) >= 1) {
|
||||
setturbo(lua_toboolean(L, 1));
|
||||
return 0;
|
||||
} else {
|
||||
setturbo(true);
|
||||
return 0;
|
||||
}
|
||||
static int cpp_sys_updateFullSpeed(lua_State *L) {
|
||||
setupdatemode(UPDATE_ALWAYS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_sys_updateEvents(lua_State *L) {
|
||||
setupdatemode(UPDATE_WAIT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_sys_updateTimeout(lua_State *L) {
|
||||
setupdatemode(UPDATE_TIMEOUT, luaL_checknumber(L, 1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_sys_dir(lua_State *L) {
|
||||
@@ -785,8 +790,12 @@ extern "C" {
|
||||
}
|
||||
|
||||
static int cpp_pad_press(lua_State *L) {
|
||||
int8_t i = luaL_checkinteger(L, 1);
|
||||
lua_pushboolean(L, padp(i));
|
||||
if (lua_gettop(L) >=1 ) {
|
||||
int8_t i = luaL_checkinteger(L, 1);
|
||||
lua_pushboolean(L, padp(i));
|
||||
} else {
|
||||
lua_pushinteger(L, wpad());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -829,7 +838,7 @@ void push_lua_funcs() {
|
||||
lua_pushcfunction(L,cpp_map_draw); lua_setfield(L, -2, "draw");
|
||||
lua_pushcfunction(L,cpp_map_getTile); lua_setfield(L, -2, "getTile");
|
||||
lua_pushcfunction(L,cpp_map_setTile); lua_setfield(L, -2, "setTile");
|
||||
lua_setglobal(L, "map");
|
||||
lua_setglobal(L, "tilemap");
|
||||
|
||||
lua_newtable(L);
|
||||
lua_pushcfunction(L,cpp_pal_load); lua_setfield(L, -2, "load");
|
||||
@@ -893,7 +902,9 @@ void push_lua_funcs() {
|
||||
lua_pushcfunction(L,cpp_sys_time); lua_setfield(L, -2, "getTime");
|
||||
lua_pushcfunction(L,cpp_sys_setBeat); lua_setfield(L, -2, "setBeat");
|
||||
lua_pushcfunction(L,cpp_sys_isBeat); lua_setfield(L, -2, "isBeat");
|
||||
lua_pushcfunction(L,cpp_sys_setTurbo); lua_setfield(L, -2, "setTurbo");
|
||||
lua_pushcfunction(L,cpp_sys_updateFullSpeed); lua_setfield(L, -2, "updateAtFullSpeed");
|
||||
lua_pushcfunction(L,cpp_sys_updateEvents); lua_setfield(L, -2, "updateOnlyOnEvents");
|
||||
lua_pushcfunction(L,cpp_sys_updateTimeout); lua_setfield(L, -2, "updateOnEventsAndTimeout");
|
||||
lua_pushcfunction(L,cpp_sys_dir); lua_setfield(L, -2, "getFilesInDataDirectory");
|
||||
lua_pushcfunction(L,cpp_sys_exit); lua_setfield(L, -2, "quit");
|
||||
lua_setglobal(L, "system");
|
||||
@@ -955,16 +966,16 @@ void push_lua_funcs() {
|
||||
lua_pushinteger(L, 27); lua_setfield(L, -2, "X");
|
||||
lua_pushinteger(L, 28); lua_setfield(L, -2, "Y");
|
||||
lua_pushinteger(L, 29); lua_setfield(L, -2, "Z");
|
||||
lua_pushinteger(L, 30); lua_setfield(L, -2, "1");
|
||||
lua_pushinteger(L, 31); lua_setfield(L, -2, "2");
|
||||
lua_pushinteger(L, 32); lua_setfield(L, -2, "3");
|
||||
lua_pushinteger(L, 33); lua_setfield(L, -2, "4");
|
||||
lua_pushinteger(L, 34); lua_setfield(L, -2, "5");
|
||||
lua_pushinteger(L, 35); lua_setfield(L, -2, "6");
|
||||
lua_pushinteger(L, 36); lua_setfield(L, -2, "7");
|
||||
lua_pushinteger(L, 37); lua_setfield(L, -2, "8");
|
||||
lua_pushinteger(L, 38); lua_setfield(L, -2, "9");
|
||||
lua_pushinteger(L, 39); lua_setfield(L, -2, "0");
|
||||
lua_pushinteger(L, 30); lua_setfield(L, -2, "N1");
|
||||
lua_pushinteger(L, 31); lua_setfield(L, -2, "N2");
|
||||
lua_pushinteger(L, 32); lua_setfield(L, -2, "N3");
|
||||
lua_pushinteger(L, 33); lua_setfield(L, -2, "N4");
|
||||
lua_pushinteger(L, 34); lua_setfield(L, -2, "N5");
|
||||
lua_pushinteger(L, 35); lua_setfield(L, -2, "N6");
|
||||
lua_pushinteger(L, 36); lua_setfield(L, -2, "N7");
|
||||
lua_pushinteger(L, 37); lua_setfield(L, -2, "N8");
|
||||
lua_pushinteger(L, 38); lua_setfield(L, -2, "N9");
|
||||
lua_pushinteger(L, 39); lua_setfield(L, -2, "N0");
|
||||
lua_pushinteger(L, 40); lua_setfield(L, -2, "RETURN");
|
||||
lua_pushinteger(L, 41); lua_setfield(L, -2, "ESCAPE");
|
||||
lua_pushinteger(L, 42); lua_setfield(L, -2, "BACKSPACE");
|
||||
|
||||
Reference in New Issue
Block a user