diff options
author | chai <chaifix@163.com> | 2018-09-02 18:44:15 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-09-02 18:44:15 +0800 |
commit | 4f147c08fc5498af393729c5e4a3d91894c97467 (patch) | |
tree | 0a00c636b84238d60bd4535dc988591e24d15458 /src/lua/modules/graphics/graphics.cpp | |
parent | 6d67345bd5ddea7a4ce37e6bbeda15d341b1ee82 (diff) |
*update
Diffstat (limited to 'src/lua/modules/graphics/graphics.cpp')
-rw-r--r-- | src/lua/modules/graphics/graphics.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lua/modules/graphics/graphics.cpp b/src/lua/modules/graphics/graphics.cpp index cd79211..fadc59d 100644 --- a/src/lua/modules/graphics/graphics.cpp +++ b/src/lua/modules/graphics/graphics.cpp @@ -42,6 +42,14 @@ namespace lua return 1; } + static int l_setTitle(lua_State* L) + { + Window* wnd = Window::get(); + const char* title = luax_checkstring(L, 1); + wnd->setTitle(title); + return 0; + } + static int l_destroy(lua_State* L) { Window* wnd = Window::get(); @@ -189,7 +197,10 @@ namespace lua context.curRenderColor.rgba.r = luax_checknumber(L, 1); context.curRenderColor.rgba.g = luax_checknumber(L, 2); context.curRenderColor.rgba.b = luax_checknumber(L, 3); - context.curRenderColor.rgba.a = luax_checknumber(L, 4); + if (luax_gettop(L) == 4) + context.curRenderColor.rgba.a = luax_checknumber(L, 4); + else + context.curClearColor.rgba.a = 255; glColor4f(context.curRenderColor.rgba.r / 255.f, context.curRenderColor.rgba.g / 255.f, @@ -463,6 +474,7 @@ namespace lua static const luaL_Reg f[] = { { "init", l_init }, + { "setTitle", l_setTitle }, { "getSize", l_getSize }, { "getWidth", l_getWidth }, { "getHeight", l_getHeight }, |