Browse Source

Fix lovr.graphics.print;

bjorn 3 years ago
parent
commit
40ffe5cf5d
2 changed files with 51 additions and 14 deletions
  1. 34 1
      api/init.lua
  2. 17 13
      api/lovr/graphics/print.lua

+ 34 - 1
api/init.lua

@@ -6216,6 +6216,39 @@ return {
           module = "lovr.graphics",
           notes = "TODO",
           variants = {
+            {
+              arguments = {
+                {
+                  name = "text",
+                  type = "string",
+                  description = "The text to render."
+                },
+                {
+                  name = "transform",
+                  type = "transform",
+                  description = "The transform of the text."
+                },
+                {
+                  name = "wrap",
+                  type = "number",
+                  description = "The maximum width of each line in meters (before scale is applied).  When zero, the text will not wrap.",
+                  default = "0"
+                },
+                {
+                  name = "halign",
+                  type = "HorizontalAlign",
+                  description = "The horizontal alignment.",
+                  default = "'center'"
+                },
+                {
+                  name = "valign",
+                  type = "VerticalAlign",
+                  description = "The vertical alignment.",
+                  default = "'middle'"
+                }
+              },
+              returns = {}
+            },
             {
               arguments = {
                 {
@@ -6236,7 +6269,7 @@ return {
                 {
                   name = "wrap",
                   type = "number",
-                  description = "[\n        The maximum width of each line in meters (before scale is applied).  When zero, the text\n        will not wrap.",
+                  description = "The maximum width of each line in meters (before scale is applied).  When zero, the text will not wrap.",
                   default = "0"
                 },
                 {

+ 17 - 13
api/lovr/graphics/print.lua

@@ -3,43 +3,47 @@ return {
   summary = 'Draw text.',
   description = 'TODO',
   arguments = {
-    {
-      name = 'font',
+    font = {
       type = 'Font',
       description = 'The Font to use.'
     },
-    {
-      name = 'text',
+    text = {
       type = 'string',
       description = 'The text to render.'
     },
-    {
-      name = 'transform',
+    transform = {
       type = 'transform',
       description = 'The transform of the text.'
     },
-    {
-      name = 'wrap',
+    wrap = {
       type = 'number',
       default = '0',
-      description = [[[
+      description = [[
         The maximum width of each line in meters (before scale is applied).  When zero, the text
         will not wrap.
       ]]
     },
-    {
-      name = 'halign',
+    halign = {
       type = 'HorizontalAlign',
       default = [['center']],
       description = 'The horizontal alignment.'
     },
-    {
-      name = 'valign',
+    valign = {
       type = 'VerticalAlign',
       default = [['middle']],
       description = 'The vertical alignment.'
     }
   },
   returns = {},
+  variants = {
+    {
+      arguments = { 'text', 'transform', 'wrap', 'halign', 'valign' },
+      returns = {}
+    },
+    {
+      arguments = { 'font', 'text', 'transform', 'wrap', 'halign', 'valign' },
+      returns = {}
+    }
+  },
   notes = 'TODO'
 }