clear.lua 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. return {
  2. tag = 'window',
  3. summary = 'Clear the screen.',
  4. description = [[
  5. Clears the screen, resetting the color, depth, and stencil information to default values. This
  6. function is called automatically by `lovr.run` at the beginning of each frame to clear out the
  7. data from the previous frame.
  8. ]],
  9. arguments = {
  10. color = {
  11. type = 'boolean',
  12. default = 'true',
  13. description = 'Whether or not to clear color information on the screen.'
  14. },
  15. depth = {
  16. type = 'boolean',
  17. default = 'true',
  18. description = 'Whether or not to clear the depth information on the screen.'
  19. },
  20. stencil = {
  21. type = 'boolean',
  22. default = 'true',
  23. description = 'Whether or not to clear the stencil information on the screen.'
  24. },
  25. r = {
  26. type = 'number',
  27. description = 'The value to clear the red channel to, from 0.0 to 1.0.'
  28. },
  29. g = {
  30. type = 'number',
  31. description = 'The value to clear the green channel to, from 0.0 to 1.0.'
  32. },
  33. b = {
  34. type = 'number',
  35. description = 'The value to clear the blue channel to, from 0.0 to 1.0.'
  36. },
  37. a = {
  38. type = 'number',
  39. description = 'The value to clear the alpha channel to, from 0.0 to 1.0.'
  40. },
  41. hex = {
  42. type = 'number',
  43. description = 'A hexcode to clear the color to, in the form `0xffffff` (alpha unsupported).'
  44. },
  45. z = {
  46. type = 'number',
  47. default = '1.0',
  48. description = 'The value to clear the depth buffer to.'
  49. },
  50. s = {
  51. type = 'number',
  52. default = '0',
  53. description = 'The integer value to clear the stencil buffer to.'
  54. }
  55. },
  56. returns = {},
  57. variants = {
  58. {
  59. description = [[
  60. Clears the color, depth, and stencil to their default values. Color will be cleared to the
  61. current background color, depth will be cleared to 1.0, and stencil will be cleared to 0.
  62. ]],
  63. arguments = { 'color', 'depth', 'stencil' },
  64. returns = {}
  65. },
  66. {
  67. arguments = { 'r', 'g', 'b', 'a', 'z', 's' },
  68. returns = {}
  69. },
  70. {
  71. arguments = { 'hex' },
  72. returns = {}
  73. }
  74. },
  75. notes = [[
  76. The first two variants of this function can be mixed and matched, meaning you can use booleans
  77. for some of the values and numeric values for others.
  78. If you are using `lovr.graphics.setStencilTest`, it will not affect how the screen gets cleared.
  79. Instead, you can use `lovr.graphics.fill` to draw a fullscreen quad, which will get masked by
  80. the active stencil.
  81. ]],
  82. related = {
  83. 'lovr.graphics.setBackgroundColor'
  84. }
  85. }