print.lua 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. return {
  2. tag = 'graphicsPrimitives',
  3. summary = 'Render text.',
  4. description = 'Draws text in 3D space using the active font.',
  5. arguments = {
  6. {
  7. name = 'str',
  8. type = 'string',
  9. description = 'The text to render.'
  10. },
  11. {
  12. name = 'x',
  13. type = 'number',
  14. default = 0,
  15. description = 'The x coordinate of the center of the text.'
  16. },
  17. {
  18. name = 'y',
  19. type = 'number',
  20. default = 0,
  21. description = 'The y coordinate of the center of the text.'
  22. },
  23. {
  24. name = 'z',
  25. type = 'number',
  26. default = 0,
  27. description = 'The z coordinate of the center of the text.'
  28. },
  29. {
  30. name = 'scale',
  31. type = 'number',
  32. default = 1,
  33. description = 'The scale of the text.'
  34. },
  35. {
  36. name = 'angle',
  37. type = 'number',
  38. default = 0,
  39. description = 'The number of radians to rotate the text around its rotation axis.'
  40. },
  41. {
  42. name = 'ax',
  43. type = 'number',
  44. default = 0,
  45. description = 'The x component of the axis of rotation.'
  46. },
  47. {
  48. name = 'ay',
  49. type = 'number',
  50. default = 1,
  51. description = 'The y component of the axis of rotation.'
  52. },
  53. {
  54. name = 'az',
  55. type = 'number',
  56. default = 0,
  57. description = 'The z component of the axis of rotation.'
  58. },
  59. {
  60. name = 'wrap',
  61. type = 'number',
  62. default = '0',
  63. description = [[
  64. The maximum width of each line, in meters (before scale is applied). Set to 0 or nil for no
  65. wrapping.
  66. ]]
  67. },
  68. {
  69. name = 'halign',
  70. type = 'HorizontalAlign',
  71. default = [['center']],
  72. description = 'The horizontal alignment.'
  73. },
  74. {
  75. name = 'valign',
  76. type = 'VerticalAlign',
  77. default = [['middle']],
  78. description = 'The vertical alignment.'
  79. }
  80. },
  81. returns = {},
  82. notes = [[
  83. Unicode text is supported.
  84. Use `\n` to add line breaks. `\t` will be rendered as four spaces.
  85. LÖVR uses a fancy technique for font rendering called multichannel signed distance fields. This
  86. leads to crisp text in VR, but requires a special shader to use. LÖVR internally switches to
  87. the appropriate shader, but only when the default shader is already set. If you see strange
  88. font artifacts, make sure you switch back to the default shader by using
  89. `lovr.graphics.setShader()` before you draw text.
  90. ]],
  91. related = {
  92. 'lovr.graphics.getFont',
  93. 'lovr.graphics.setFont',
  94. 'lovr.graphics.newFont',
  95. 'Font'
  96. }
  97. }