From 6219608238afd56634bdd76e096ee894e90b3a2b Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 26 Oct 2018 22:17:03 +0800 Subject: =?UTF-8?q?*=E5=A2=9E=E5=8A=A0SDL2=20include?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/embed/boot.lua.h | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/lua/embed/boot.lua.h') diff --git a/src/lua/embed/boot.lua.h b/src/lua/embed/boot.lua.h index ca08e87..390cb47 100644 --- a/src/lua/embed/boot.lua.h +++ b/src/lua/embed/boot.lua.h @@ -20,14 +20,6 @@ jin.config.resizable = jin.config.resizable or false jin.config.fullscreen = jin.config.fullscreen or false jin.config.fps = jin.config.fps or 60 -------------------------------------------------------------------------- --- Initialize sub systems -------------------------------------------------------------------------- - -jin.graphics.init(jin.config) -jin.audio.init() --- TODO: Disable some internal lua modules. - ------------------------------------------------------------------------- -- Default game loop ------------------------------------------------------------------------- @@ -82,6 +74,7 @@ end -- Display error message. local function onError(msg) + jin.graphics.init(jin.config) local err = "Error:\n" .. msg .. "\n" .. debug.traceback() jin.graphics.reset() jin.graphics.setClearColor(100, 100, 100, 255) @@ -94,21 +87,26 @@ end -- No game screen. local function noGame() jin.graphics.reset() - jin.graphics.reset() - jin.graphics.setClearColor(100, 100, 100, 255) jin.graphics.clear() jin.graphics.print("No Game", 5, 5) jin.graphics.present() plainLoop() end +------------------------------------------------------------------------- +-- Initialize sub systems +------------------------------------------------------------------------- + +-- TODO: Disable some internal lua modules. + local function boot() if jin.filesystem.exist("main.lua") then - call(function() - require"main" - jin.core.run() - end) + call(function() require"main" end) + jin.graphics.init(jin.config) + jin.audio.init() + call(jin.core.run) else + jin.graphics.init(jin.config) noGame() end end -- cgit v1.1-26-g67d0