Changes applied to support generic virtual screens
This commit is contained in:
44
lua.cpp
44
lua.cpp
@@ -3,6 +3,43 @@
|
||||
#include "mini.h"
|
||||
|
||||
extern "C" {
|
||||
static int cpp_newsurf(lua_State *L) {
|
||||
int w = luaL_checknumber(L, 1);
|
||||
int h = luaL_checknumber(L, 2);
|
||||
lua_pushinteger(L, newsurf(w, h));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cpp_loadsurf(lua_State *L) {
|
||||
const char* str = luaL_checkstring(L, 1);
|
||||
lua_pushinteger(L, loadsurf(str));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cpp_freesurf(lua_State *L) {
|
||||
uint8_t surface = luaL_checkinteger(L, 1);
|
||||
freesurf(surface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_setdest(lua_State *L) {
|
||||
uint8_t surface = luaL_checkinteger(L, 1);
|
||||
setdest(surface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_setsource(lua_State *L) {
|
||||
uint8_t surface = luaL_checkinteger(L, 1);
|
||||
setsource(surface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_setmap(lua_State *L) {
|
||||
uint8_t surface = luaL_checkinteger(L, 1);
|
||||
setmap(surface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_cls(lua_State *L) {
|
||||
uint8_t color = luaL_optinteger(L, 1, 0);
|
||||
cls(color);
|
||||
@@ -461,6 +498,13 @@ void lua_init() {
|
||||
return;
|
||||
}
|
||||
|
||||
lua_pushcfunction(L,cpp_newsurf); lua_setglobal(L, "newsurf");
|
||||
lua_pushcfunction(L,cpp_loadsurf); lua_setglobal(L, "loadsurf");
|
||||
lua_pushcfunction(L,cpp_freesurf); lua_setglobal(L, "freesurf");
|
||||
lua_pushcfunction(L,cpp_setdest); lua_setglobal(L, "setdest");
|
||||
lua_pushcfunction(L,cpp_setsource); lua_setglobal(L, "setsource");
|
||||
lua_pushcfunction(L,cpp_setmap); lua_setglobal(L, "setmap");
|
||||
|
||||
lua_pushcfunction(L,cpp_cls); lua_setglobal(L, "cls");
|
||||
lua_pushcfunction(L,cpp_color); lua_setglobal(L, "color");
|
||||
lua_pushcfunction(L,cpp_pal); lua_setglobal(L, "pal");
|
||||
|
||||
Reference in New Issue
Block a user