From 8ad6a7f955182955aec1fff0ed367f564f31e46a Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 19 May 2018 09:15:28 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AA=97=E5=8F=A3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/script/graphics/luaopen_graphics.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src/script/graphics/luaopen_graphics.cpp') 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); -- cgit v1.1-26-g67d0