aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/graphics/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/modules/graphics/graphics.cpp')
-rw-r--r--src/lua/modules/graphics/graphics.cpp14
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 },