diff options
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/embed/boot.lua.h | 8 | ||||
-rw-r--r-- | src/lua/modules/graphics/je_lua_graphics.cpp | 21 |
2 files changed, 26 insertions, 3 deletions
diff --git a/src/lua/embed/boot.lua.h b/src/lua/embed/boot.lua.h index 2369b0f..0884188 100644 --- a/src/lua/embed/boot.lua.h +++ b/src/lua/embed/boot.lua.h @@ -19,6 +19,7 @@ jin.config.title = jin.config.title or ("jin v" .. jin.version) jin.config.resizable = jin.config.resizable or false jin.config.fullscreen = jin.config.fullscreen or false jin.config.fps = jin.config.fps or 60 +jin.config.icon = jin.config.icon or "" ------------------------------------------------------------------------- -- Default game loop @@ -62,6 +63,7 @@ end -- Display error message. local function onError(msg) + jin.graphics.showWindow() local err = "Error:\n" .. msg .. "\n" .. debug.traceback() jin.graphics.reset() jin.graphics.setClearColor(100, 100, 100, 255) @@ -80,7 +82,7 @@ end -- No game screen. local function noGame() - jin.graphics.reset() + jin.graphics.showWindow() jin.graphics.reset() jin.graphics.setClearColor(100, 100, 100, 255) jin.graphics.clear() @@ -114,6 +116,10 @@ end jin.audio.init() jin.graphics.init(jin.config) +------------------------------------------------------------------------- +-- Boot game +------------------------------------------------------------------------- + xpcall(boot, onError) ------------------------------------------------------------------------- diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp index 7efb2e7..c45a939 100644 --- a/src/lua/modules/graphics/je_lua_graphics.cpp +++ b/src/lua/modules/graphics/je_lua_graphics.cpp @@ -42,6 +42,7 @@ namespace JinEngine setting.width = luax_getfieldinteger(L, 1, "width"); setting.height = luax_getfieldinteger(L, 1, "height"); setting.title = luax_getfieldstring(L, 1, "title"); + setting.icon = luax_getfieldstring(L, 1, "icon"); setting.vsync = luax_getfieldbool(L, 1, "vsync"); setting.fullscreen = luax_getfieldbool(L, 1, "fullscreen"); setting.resizable = luax_getfieldbool(L, 1, "resizable"); @@ -77,7 +78,21 @@ namespace JinEngine wnd->quit(); return 0; } - + + LUA_IMPLEMENT int l_showWindow(lua_State* L) + { + Window* wnd = Window::get(); + wnd->show(); + return 0; + } + + LUA_IMPLEMENT int l_hideWindow(lua_State* L) + { + Window* wnd = Window::get(); + wnd->hide(); + return 0; + } + LUA_IMPLEMENT int l_getSize(lua_State* L) { Window* wnd = Window::get(); @@ -742,7 +757,9 @@ namespace JinEngine { "getSize", l_getSize }, { "getWidth", l_getWidth }, { "getHeight", l_getHeight }, - { "destroy", l_destroy }, + { "destroy", l_destroy }, + { "hideWindow", l_hideWindow }, + { "showWindow", l_showWindow }, /* creators */ { "newBitmap", l_newBitmap }, { "newTexture", l_newTexture }, |