conf.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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 = 'version',
  17. type = 'string',
  18. description = 'The version of LÖVR this project targets (not used yet).'
  19. },
  20. {
  21. name = 'identity',
  22. type = 'string',
  23. description = 'A unique label for this project.'
  24. },
  25. {
  26. name = 'saveprecedence',
  27. type = 'boolean',
  28. description = [[
  29. Whether the files in the save directory should have precedence over files in the source
  30. archive.
  31. ]]
  32. },
  33. {
  34. name = 'modules',
  35. type = 'table',
  36. description = 'The set of enabled modules to use.',
  37. table = {
  38. {
  39. name = 'audio',
  40. type = 'boolean',
  41. description = 'Whether the audio module should be enabled.'
  42. },
  43. {
  44. name = 'data',
  45. type = 'boolean',
  46. description = 'Whether the data module should be enabled.'
  47. },
  48. {
  49. name = 'event',
  50. type = 'boolean',
  51. description = 'Whether the event module should be enabled.'
  52. },
  53. {
  54. name = 'graphics',
  55. type = 'boolean',
  56. description = 'Whether the graphics module should be enabled.'
  57. },
  58. {
  59. name = 'headset',
  60. type = 'boolean',
  61. description = 'Whether the headset module should be enabled.'
  62. },
  63. {
  64. name = 'math',
  65. type = 'boolean',
  66. description = 'Whether the math module should be enabled.'
  67. },
  68. {
  69. name = 'physics',
  70. type = 'boolean',
  71. description = 'Whether the physics module should be enabled.'
  72. },
  73. {
  74. name = 'system',
  75. type = 'boolean',
  76. description = 'Whether the system module should be enabled.'
  77. },
  78. {
  79. name = 'thread',
  80. type = 'boolean',
  81. description = 'Whether the thread module should be enabled.'
  82. },
  83. {
  84. name = 'timer',
  85. type = 'boolean',
  86. description = 'Whether the timer module should be enabled.'
  87. }
  88. }
  89. },
  90. {
  91. name = 'audio',
  92. type = 'table',
  93. description = 'Configuration for the audio module.',
  94. table = {
  95. {
  96. name = 'spatializer',
  97. type = 'string',
  98. description = [[
  99. An audio spatializer to use (`simple`, `oculus`, or `phonon`). If `nil`, all of
  100. them are attempted.
  101. ]]
  102. },
  103. {
  104. name = 'samplerate',
  105. type = 'number',
  106. description = 'The sample rate to use for audio playback.'
  107. },
  108. {
  109. name = 'start',
  110. type = 'boolean',
  111. description = 'Whether the playback device should be automatically started.'
  112. }
  113. }
  114. },
  115. {
  116. name = 'graphics',
  117. type = 'table',
  118. description = 'Configuration for the graphics module.',
  119. table = {
  120. {
  121. name = 'debug',
  122. type = 'boolean',
  123. description = 'Whether debug messages from the GPU should get sent to lovr.log.'
  124. },
  125. {
  126. name = 'vsync',
  127. type = 'boolean',
  128. description = 'Whether vsync is enabled (forced off when VR is active).'
  129. },
  130. {
  131. name = 'stencil',
  132. type = 'boolean',
  133. description = 'Whether the desktop window should have a stencil buffer.'
  134. },
  135. {
  136. name = 'antialias',
  137. type = 'boolean',
  138. description = 'Whether the desktop window rendering should be antialiased.'
  139. },
  140. {
  141. name = 'shadercache',
  142. type = 'boolean',
  143. description = 'Whether the shader cache should be loaded and saved to disk.'
  144. }
  145. }
  146. },
  147. {
  148. name = 'headset',
  149. type = 'table',
  150. description = 'Configuration for the headset.',
  151. table = {
  152. {
  153. name = 'drivers',
  154. type = 'table',
  155. description = 'An ordered list of preferred headset drivers.'
  156. },
  157. {
  158. name = 'supersample',
  159. type = 'number',
  160. description = [[
  161. A scaling factor to apply to the headset texture. Can be any positive floating
  162. point number, which gets multiplied by the default texture resolution. A value
  163. greater than 1 improves visual quality but reduces performance. Can also be a
  164. boolean, where "true" means "2.0".
  165. ]]
  166. },
  167. {
  168. name = 'seated',
  169. type = 'boolean',
  170. description = [[
  171. Whether <a data-key="lovr.headset.isSeated">seated mode</a> should be used instead
  172. of standing, changing the headset coordinate space to place y=0 at eye level.
  173. ]]
  174. },
  175. {
  176. name = 'antialias',
  177. type = 'boolean',
  178. description = 'Whether headset rendering should be antialiased.'
  179. },
  180. {
  181. name = 'stencil',
  182. type = 'boolean',
  183. description = 'Whether headset rendering should have a stencil buffer.'
  184. },
  185. {
  186. name = 'submitdepth',
  187. type = 'boolean',
  188. description = [[
  189. Whether the depth buffer should be sent to the VR runtime (improves reprojection).
  190. ]]
  191. },
  192. {
  193. name = 'overlay',
  194. type = 'boolean',
  195. description = [[
  196. Whether the project should run as an overlay. Can also be a number to control sort
  197. order against other overlays (default is zero, higher numbers go on top).
  198. ]]
  199. }
  200. }
  201. },
  202. {
  203. name = 'math',
  204. type = 'table',
  205. description = 'Configuration for the math module.',
  206. table = {
  207. {
  208. name = 'globals',
  209. type = 'boolean',
  210. description = 'Whether vector object functions should be added to the global scope.'
  211. }
  212. }
  213. },
  214. {
  215. name = 'window',
  216. type = 'table',
  217. description = 'Configuration for the window.',
  218. table = {
  219. {
  220. name = 'width',
  221. type = 'number',
  222. description = 'The width of the window.'
  223. },
  224. {
  225. name = 'height',
  226. type = 'number',
  227. description = 'The height of the window.'
  228. },
  229. {
  230. name = 'fullscreen',
  231. type = 'boolean',
  232. description = 'Whether the window is fullscreen.'
  233. },
  234. {
  235. name = 'resizable',
  236. type = 'boolean',
  237. description = 'Whether the window is resizable.'
  238. },
  239. {
  240. name = 'title',
  241. type = 'string',
  242. description = 'The window title.'
  243. },
  244. {
  245. name = 'icon',
  246. type = 'string',
  247. description = 'The path to the window icon file.'
  248. }
  249. }
  250. }
  251. }
  252. }
  253. },
  254. returns = {},
  255. notes = [[
  256. Disabling unused modules can improve startup time.
  257. `t.window` can be set to nil to avoid creating the window. The window can later be opened
  258. manually using `lovr.system.openWindow`.
  259. Enabling the `t.graphics.debug` flag will add additional error checks and will send messages
  260. from the GPU driver to the `lovr.log` callback. This will decrease performance but can help
  261. provide information on performance problems or other bugs. It will also cause
  262. `lovr.graphics.newShader` to embed debugging information in shaders which allows inspecting
  263. variables and stepping through shaders line-by-line in tools like RenderDoc.
  264. `t.graphics.debug` can also be enabled using the `--graphics-debug` command line option.
  265. ]],
  266. example = {
  267. description = 'A noop conf.lua that sets all configuration settings to their defaults:',
  268. code = [[
  269. function lovr.conf(t)
  270. -- Set the project version and identity
  271. t.version = '0.17.0'
  272. t.identity = 'default'
  273. -- Set save directory precedence
  274. t.saveprecedence = true
  275. -- Enable or disable different modules
  276. t.modules.audio = true
  277. t.modules.data = true
  278. t.modules.event = true
  279. t.modules.graphics = true
  280. t.modules.headset = true
  281. t.modules.math = true
  282. t.modules.physics = true
  283. t.modules.system = true
  284. t.modules.thread = true
  285. t.modules.timer = true
  286. -- Audio
  287. t.audio.spatializer = nil
  288. t.audio.samplerate = 48000
  289. t.audio.start = true
  290. -- Graphics
  291. t.graphics.debug = false
  292. t.graphics.vsync = true
  293. t.graphics.stencil = false
  294. t.graphics.antialias = true
  295. t.graphics.shadercache = true
  296. -- Headset settings
  297. t.headset.drivers = { 'openxr', 'desktop' }
  298. t.headset.supersample = false
  299. t.headset.seated = false
  300. t.headset.antialias = true
  301. t.headset.stencil = false
  302. t.headset.submitdepth = true
  303. t.headset.overlay = false
  304. -- Math settings
  305. t.math.globals = true
  306. -- Configure the desktop window
  307. t.window.width = 1080
  308. t.window.height = 600
  309. t.window.fullscreen = false
  310. t.window.resizable = false
  311. t.window.title = 'LÖVR'
  312. t.window.icon = nil
  313. end
  314. ]]
  315. },
  316. related = {
  317. 'lovr.load'
  318. }
  319. }