conf.lua 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. return {
  2. tag = 'callbacks',
  3. summary = 'Called to read configuration settings at startup.',
  4. description = [[
  5. The `lovr.conf` callback lets you configure default settings for LÖVR. It is called once right
  6. before the game starts. Make sure you put `lovr.conf` in a file called `conf.lua`, a special
  7. file that's loaded before the rest of the framework initializes.
  8. ]],
  9. arguments = {
  10. {
  11. name = 't',
  12. type = 'table',
  13. description = 'The table to edit the configuration settings on.',
  14. table = {
  15. {
  16. name = 'identity',
  17. type = 'string',
  18. description = 'A unique label for this project.'
  19. },
  20. {
  21. name = 'audio',
  22. type = 'table',
  23. description = 'Configuration for the audio module.',
  24. table = {
  25. {
  26. name = 'spatializer',
  27. type = 'string',
  28. description = [[
  29. An audio spatializer to use (`simple`, `oculus`, or `phonon`). If `nil`, all of
  30. them are attempted.'
  31. ]]
  32. },
  33. {
  34. name = 'start',
  35. type = 'boolean',
  36. description = 'Whether the playback device should be automatically started.'
  37. }
  38. }
  39. },
  40. {
  41. name = 'headset',
  42. type = 'table',
  43. description = 'Configuration for the headset.',
  44. table = {
  45. {
  46. name = 'drivers',
  47. type = 'table',
  48. description = 'An ordered list of preferred headset drivers.'
  49. },
  50. {
  51. name = 'msaa',
  52. type = 'number',
  53. description = 'The amount of antialiasing to use when rendering to the headset.'
  54. },
  55. {
  56. name = 'offset',
  57. type = 'number',
  58. description = 'The vertical offset for seated experiences.'
  59. }
  60. }
  61. },
  62. {
  63. name = 'math',
  64. type = 'table',
  65. description = 'Configuration for the math module.',
  66. table = {
  67. {
  68. name = 'ffi',
  69. type = 'boolean',
  70. description = 'Whether vector objects should use an optimized LuaJIT FFI codepath.'
  71. },
  72. {
  73. name = 'globals',
  74. type = 'boolean',
  75. description = 'Whether vector object functions should be added to the global scope.'
  76. }
  77. }
  78. },
  79. {
  80. name = 'modules',
  81. type = 'table',
  82. description = 'The set of enabled modules to use.',
  83. table = {
  84. {
  85. name = 'audio',
  86. type = 'boolean',
  87. description = 'Whether the audio module should be enabled.'
  88. },
  89. {
  90. name = 'data',
  91. type = 'boolean',
  92. description = 'Whether the data module should be enabled.'
  93. },
  94. {
  95. name = 'event',
  96. type = 'boolean',
  97. description = 'Whether the event module should be enabled.'
  98. },
  99. {
  100. name = 'filesystem',
  101. type = 'boolean',
  102. description = 'Whether the filesystem module should be enabled.'
  103. },
  104. {
  105. name = 'graphics',
  106. type = 'boolean',
  107. description = 'Whether the graphics module should be enabled.'
  108. },
  109. {
  110. name = 'headset',
  111. type = 'boolean',
  112. description = 'Whether the headset module should be enabled.'
  113. },
  114. {
  115. name = 'math',
  116. type = 'boolean',
  117. description = 'Whether the math module should be enabled.'
  118. },
  119. {
  120. name = 'physics',
  121. type = 'boolean',
  122. description = 'Whether the physics module should be enabled.'
  123. },
  124. {
  125. name = 'thread',
  126. type = 'boolean',
  127. description = 'Whether the thread module should be enabled.'
  128. },
  129. {
  130. name = 'timer',
  131. type = 'boolean',
  132. description = 'Whether the timer module should be enabled.'
  133. }
  134. }
  135. },
  136. {
  137. name = 'window',
  138. type = 'table',
  139. description = 'Configuration for the window.',
  140. table = {
  141. {
  142. name = 'width',
  143. type = 'number',
  144. description = 'The width of the window.'
  145. },
  146. {
  147. name = 'height',
  148. type = 'number',
  149. description = 'The height of the window.'
  150. },
  151. {
  152. name = 'fullscreen',
  153. type = 'boolean',
  154. description = 'Whether the window is fullscreen.'
  155. },
  156. {
  157. name = 'msaa',
  158. type = 'number',
  159. description = 'The number of antialiasing samples to use.'
  160. },
  161. {
  162. name = 'vsync',
  163. type = 'number',
  164. description = '0 to disable vsync, 1 to enable.'
  165. },
  166. {
  167. name = 'title',
  168. type = 'string',
  169. description = 'The window title.'
  170. },
  171. {
  172. name = 'icon',
  173. type = 'string',
  174. description = 'The path to the window icon file.'
  175. }
  176. }
  177. }
  178. }
  179. }
  180. },
  181. returns = {},
  182. notes = [[
  183. Disabling the headset module can improve startup time a lot if you aren't intending to use
  184. `lovr.headset`.
  185. You can set `t.window` to nil to avoid creating the window. You can do it yourself later by
  186. using `lovr.graphics.createWindow`.
  187. If the `lovr.graphics` module is disabled or the window isn't created, attempting to use any
  188. functionality requiring graphics may cause a crash.
  189. Enabling the `t.graphics.debug` flag will add additional error checks and will send messages
  190. from the GPU driver to the `lovr.log` callback. This will decrease performance but can help
  191. provide information on performance problems or other bugs.
  192. The `headset.offset` field is a vertical offset applied to the scene for headsets that do not
  193. center their tracking origin on the floor. This can be thought of as a "default user height".
  194. Setting this offset makes it easier to design experiences that work in both seated and standing
  195. VR configurations.
  196. ]],
  197. example = {
  198. description = 'A noop conf.lua that sets all configuration settings to their defaults:',
  199. code = [[
  200. function lovr.conf(t)
  201. -- Set the project identity
  202. t.identity = 'default'
  203. -- Audio
  204. t.audio.spatializer = nil
  205. t.audio.start = true
  206. -- Graphics
  207. t.graphics.debug = false
  208. -- Headset settings
  209. t.headset.drivers = { 'openxr', 'oculus', 'vrapi', 'openvr', 'webxr', 'desktop' }
  210. t.headset.msaa = 4
  211. t.headset.offset = 1.7
  212. -- Math settings
  213. t.math.globals = true
  214. -- Enable or disable different modules
  215. t.modules.audio = true
  216. t.modules.data = true
  217. t.modules.event = true
  218. t.modules.graphics = true
  219. t.modules.headset = true
  220. t.modules.math = true
  221. t.modules.physics = true
  222. t.modules.thread = true
  223. t.modules.timer = true
  224. -- Configure the desktop window
  225. t.window.width = 1080
  226. t.window.height = 600
  227. t.window.fullscreen = false
  228. t.window.msaa = 0
  229. t.window.vsync = 1
  230. t.window.title = 'LÖVR'
  231. t.window.icon = nil
  232. end
  233. ]]
  234. },
  235. related = {
  236. 'lovr.load'
  237. }
  238. }