Add tpt.setwindowsize(scale, fullscreen)

This commit is contained in:
jacksonmj 2011-08-30 17:26:42 +08:00 committed by Simon Robertshaw
parent e506934655
commit 741014770c
3 changed files with 20 additions and 3 deletions

View File

@ -74,4 +74,5 @@ int luatpt_setfire(lua_State* l);
int luatpt_setdebug(lua_State* l); int luatpt_setdebug(lua_State* l);
int luatpt_setfpscap(lua_State* l); int luatpt_setfpscap(lua_State* l);
int luatpt_getscript(lua_State* l); int luatpt_getscript(lua_State* l);
int luatpt_setwindowsize(lua_State* l);
#endif #endif

View File

@ -62,6 +62,7 @@ void luacon_open(){
{"setdebug", &luatpt_setdebug}, {"setdebug", &luatpt_setdebug},
{"setfpscap",&luatpt_setfpscap}, {"setfpscap",&luatpt_setfpscap},
{"getscript",&luatpt_getscript}, {"getscript",&luatpt_getscript},
{"setwindowsize",&luatpt_setwindowsize},
{NULL,NULL} {NULL,NULL}
}; };
@ -1157,4 +1158,15 @@ fin:
if(lastError) return luaL_error(l, lastError); if(lastError) return luaL_error(l, lastError);
return 0; return 0;
} }
int luatpt_setwindowsize(lua_State* l)
{
int result, scale = luaL_optint(l,1,1), kiosk = luaL_optint(l,2,0);
if (scale!=2) scale = 1;
if (kiosk!=1) kiosk = 0;
result = set_scale(scale, kiosk);
lua_pushnumber(l, result);
return 1;
}
#endif #endif

View File

@ -1718,14 +1718,18 @@ int main(int argc, char *argv[])
} }
save_presets(0);
make_kernel(); make_kernel();
prepare_alpha(CELL, 1.0f); prepare_alpha(CELL, 1.0f);
stamp_init(); stamp_init();
if (!sdl_open())
{
sdl_scale = 1;
kiosk_enable = 0;
if (!sdl_open()) exit(1); if (!sdl_open()) exit(1);
}
save_presets(0);
http_init(http_proxy_string[0] ? http_proxy_string : NULL); http_init(http_proxy_string[0] ? http_proxy_string : NULL);
if (cpu_check()) if (cpu_check())