From 4f147c08fc5498af393729c5e4a3d91894c97467 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 2 Sep 2018 18:44:15 +0800 Subject: *update --- src/lua/modules/graphics/graphics.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/lua/modules/graphics/graphics.cpp') 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 }, -- cgit v1.1-26-g67d0