lovr.conf
The lovr.conf
callback lets you configure default settings for LÖVR. It is called once right before the game starts. Make sure you put lovr.conf
in a file called conf.lua
, a special file that's loaded before the rest of the framework initializes.
function lovr.conf(t)
-- your code here
end
Arguments
Name | Type | Description |
t | table | The table to edit the configuration settings on. |
.identity | string | A unique label for this project. |
.headset | table | Configuration for the headset. |
.drivers | table | An ordered list of preferred headset drivers. |
.msaa | number | The amount of antialiasing to use when rendering to the headset. |
.offset | number | The vertical offset for seated experiences. |
.math | table | Configuration for the math module. |
.ffi | boolean | Whether vector objects should use an optimized LuaJIT FFI codepath. |
.globals | boolean | Whether vector object functions should be added to the global scope. |
.modules | table | The set of enabled modules to use. |
.audio | boolean | Whether the audio module should be enabled. |
.data | boolean | Whether the data module should be enabled. |
.event | boolean | Whether the event module should be enabled. |
.filesystem | boolean | Whether the filesystem module should be enabled. |
.graphics | boolean | Whether the graphics module should be enabled. |
.headset | boolean | Whether the headset module should be enabled. |
.math | boolean | Whether the math module should be enabled. |
.physics | boolean | Whether the physics module should be enabled. |
.thread | boolean | Whether the thread module should be enabled. |
.timer | boolean | Whether the timer module should be enabled. |
.window | table | Configuration for the window. |
.width | number | The width of the window. |
.height | number | The height of the window. |
.fullscreen | boolean | Whether the window is fullscreen. |
.msaa | number | The number of antialiasing samples to use. |
.vsync | number | 0 to disable vsync, 1 to enable. |
.title | string | The window title. |
.icon | string | The path to the window icon file. |
Returns
Nothing
Notes
Disabling the headset
module can improve startup time a lot if you aren't intending to use lovr.headset
.
You can set t.window
to nil to avoid creating the window. You can do it yourself later by using lovr.graphics.createWindow
.
If the lovr.graphics
module is disabled or the window isn't created, attempting to use any functionality requiring graphics may cause a crash.
Enabling the t.graphics.debug
flag will add additional error checks and will send messages from the GPU driver to the lovr.log
callback. This will decrease performance but can help provide information on performance problems or other bugs.
The headset.offset
field is a vertical offset applied to the scene for headsets that do not center their tracking origin on the floor. This can be thought of as a "default user height". Setting this offset makes it easier to design experiences that work in both seated and standing VR configurations.
Example
A noop conf.lua that sets all configuration settings to their defaults:
function lovr.conf(t)
-- Set the project identity
t.identity = 'default'
-- Graphics
t.graphics.debug = false
-- Headset settings
t.headset.drivers = { 'openxr', 'oculus', 'vrapi', 'openvr', 'webxr', 'desktop' }
t.headset.msaa = 4
t.headset.offset = 1.7
-- Math settings
t.math.globals = true
-- Enable or disable different modules
t.modules.audio = true
t.modules.data = true
t.modules.event = true
t.modules.graphics = true
t.modules.headset = true
t.modules.math = true
t.modules.physics = true
t.modules.thread = true
t.modules.timer = true
-- Configure the desktop window
t.window.width = 1080
t.window.height = 600
t.window.fullscreen = false
t.window.msaa = 0
t.window.vsync = 1
t.window.title = 'LÖVR'
t.window.icon = nil
end
See also
lovr.load