Minor boot.lua refactors;

This commit is contained in:
bjorn 2023-11-01 14:38:04 -07:00
parent 703e9d3c36
commit a1309cfe87
2 changed files with 51 additions and 55 deletions

View File

@ -1,57 +1,56 @@
lovr = require 'lovr'
local lovr = lovr
-- Note: Cannot be overloaded
function lovr.boot()
local conf = {
version = '0.17.0',
identity = 'default',
saveprecedence = true,
modules = {
audio = true,
data = true,
event = true,
graphics = true,
headset = true,
math = true,
physics = true,
system = true,
thread = true,
timer = true
},
audio = {
start = true,
spatializer = nil
},
graphics = {
debug = false,
vsync = true,
stencil = false,
antialias = true,
shadercache = true
},
headset = {
drivers = { 'openxr', 'webxr', 'desktop' },
supersample = false,
seated = false,
stencil = false,
antialias = true,
submitdepth = true,
overlay = false
},
math = {
globals = true
},
window = {
width = 720,
height = 800,
fullscreen = false,
resizable = false,
title = 'LÖVR',
icon = nil
}
local conf = {
version = '0.17.0',
identity = 'default',
saveprecedence = true,
modules = {
audio = true,
data = true,
event = true,
graphics = true,
headset = true,
math = true,
physics = true,
system = true,
thread = true,
timer = true
},
audio = {
start = true,
spatializer = nil
},
graphics = {
debug = false,
vsync = true,
stencil = false,
antialias = true,
shadercache = true
},
headset = {
drivers = { 'openxr', 'webxr', 'desktop' },
supersample = false,
seated = false,
stencil = false,
antialias = true,
submitdepth = true,
overlay = false
},
math = {
globals = true
},
window = {
width = 720,
height = 800,
fullscreen = false,
resizable = false,
title = 'LÖVR',
icon = nil
}
}
function lovr.boot()
lovr.filesystem = require('lovr.filesystem')
local main = arg[0] and arg[0]:match('[^\\/]-%.lua$') or 'main.lua'
local hasConf, hasMain = lovr.filesystem.isFile('conf.lua'), lovr.filesystem.isFile(main)
@ -233,7 +232,7 @@ function lovr.log(message, level, tag)
print(message)
end
return function()
return coroutine.create(function()
local errored = false
local function onerror(...)
@ -266,4 +265,4 @@ return function()
coroutine.yield()
end
end
end)

View File

@ -111,10 +111,7 @@ int main(int argc, char** argv) {
return 1;
}
lua_State* T = lua_newthread(L);
lua_pushvalue(L, -2);
lua_xmove(L, T, 1);
lua_State* T = lua_tothread(L, -1);
lovrSetErrorCallback(luax_vthrow, T);
lovrSetLogCallback(luax_vlog, T);