- Es pot canviar la resolució des del programa abm res(w,h)
- La finestra es resizable - Es permet arrancar des d'un arxiu .lua passat com a paràmetre.
This commit is contained in:
12
lua.cpp
12
lua.cpp
@@ -825,6 +825,13 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
static int cpp_res(lua_State *L) {
|
||||
const int w = luaL_optinteger(L, 1, 160);
|
||||
const int h = luaL_optinteger(L, 2, 120);
|
||||
setres(w, h);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpp_getconf(lua_State *L) {
|
||||
const char* key = luaL_checkstring(L, 1);
|
||||
const char* value = getconfig(key);
|
||||
@@ -991,6 +998,7 @@ void push_lua_funcs() {
|
||||
lua_pushcfunction(L,cpp_zoom); lua_setglobal(L, "zoom");
|
||||
lua_pushcfunction(L,cpp_fullscreen); lua_setglobal(L, "fullscreen");
|
||||
lua_pushcfunction(L,cpp_cursor); lua_setglobal(L, "cursor");
|
||||
lua_pushcfunction(L,cpp_res); lua_setglobal(L, "res");
|
||||
|
||||
lua_pushcfunction(L,cpp_getconf); lua_setglobal(L, "getconf");
|
||||
lua_pushcfunction(L,cpp_setconf); lua_setglobal(L, "setconf");
|
||||
@@ -1154,7 +1162,7 @@ int MiniLoader(lua_State *L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void lua_init() {
|
||||
void lua_init(const char *main_lua_file) {
|
||||
L = luaL_newstate();
|
||||
luaL_openlibs(L);
|
||||
push_lua_funcs();
|
||||
@@ -1162,7 +1170,7 @@ void lua_init() {
|
||||
luaL_dostring(L, "table.insert(package.searchers,2,mini_loader)\n");
|
||||
|
||||
int size;
|
||||
char* buffer = file_getfilebuffer("main.lua", size);
|
||||
char* buffer = file_getfilebuffer(main_lua_file, size);
|
||||
if (luaL_loadbuffer(L, buffer, size, "main")) {
|
||||
debug("LOADING ERROR: ");
|
||||
debug("%s\n",lua_tostring(L, -1));
|
||||
|
||||
Reference in New Issue
Block a user