aboutsummaryrefslogtreecommitdiff
path: root/src/script/graphics/luaopen_graphics.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-05-19 09:15:28 +0800
committerchai <chaifix@163.com>2018-05-19 09:15:28 +0800
commit8ad6a7f955182955aec1fff0ed367f564f31e46a (patch)
tree44224262d2b19d68d04137bb50e2a11490b6c8a8 /src/script/graphics/luaopen_graphics.cpp
parentbda9d88e84a1dccd4df978205a6ba1f141178b0c (diff)
修改窗口配置
Diffstat (limited to 'src/script/graphics/luaopen_graphics.cpp')
-rw-r--r--src/script/graphics/luaopen_graphics.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/script/graphics/luaopen_graphics.cpp b/src/script/graphics/luaopen_graphics.cpp
index 0d240fe..50b1921 100644
--- a/src/script/graphics/luaopen_graphics.cpp
+++ b/src/script/graphics/luaopen_graphics.cpp
@@ -18,13 +18,10 @@ namespace lua
*/
static struct
{
- // current render color
color curRenderColor;
- // currently used font
Font* curFont = 0;
- // default ingame font
Font* defaultFont = 0;
} context;
@@ -35,21 +32,13 @@ namespace lua
*/
static int l_init(lua_State* L)
{
- int w = luax_checknumber(L, 1);
- int h = luax_checknumber(L, 2);
- const char* t = luaL_checkstring(L, 3);
-
- // init video subsystem
- if (SDL_Init(SDL_INIT_VIDEO) < 0)
- {
- luax_error(L, "could not init video");
- luax_pushboolean(L, false);
- return 1;
- }
-
- // init window system
Window* wnd = Window::get();
- wnd->init(w, h, t);
+ Window::Setting setting;
+ setting.width = luax_getfield_integer(L, 1, "width");
+ setting.height = luax_getfield_integer(L, 1, "height");
+ setting.title = luax_getfield_string(L, 1, "title");
+ setting.vsync = luax_getfield_bool(L, 1, "vsync");
+ wnd->init(setting);
// set default blend method
glEnable(GL_BLEND);