Browse Source

Fix Font:getVertices;

bjorn 1 year ago
parent
commit
bbe2cc2b88
2 changed files with 53 additions and 1 deletions
  1. 48 0
      api/init.lua
  2. 5 1
      api/lovr/graphics/Font/getVertices.lua

+ 48 - 0
api/init.lua

@@ -13938,6 +13938,54 @@ return {
               variants = {
               variants = {
                 {
                 {
                   arguments = {
                   arguments = {
+                    {
+                      name = "string",
+                      type = "string",
+                      description = "The text to render."
+                    },
+                    {
+                      name = "wrap",
+                      type = "number",
+                      description = "The maximum line length.  The units depend on the pixel density of the font, but are in meters by default.",
+                      default = "0"
+                    },
+                    {
+                      name = "halign",
+                      type = "HorizontalAlign",
+                      description = "The horizontal align."
+                    },
+                    {
+                      name = "valign",
+                      type = "VerticalAlign",
+                      description = "The vertical align."
+                    }
+                  },
+                  returns = {
+                    {
+                      name = "vertices",
+                      type = "table",
+                      description = "The table of vertices.  See below for the format of each vertex."
+                    },
+                    {
+                      name = "material",
+                      type = "Material",
+                      description = "A Material to use when rendering the vertices."
+                    }
+                  }
+                },
+                {
+                  arguments = {
+                    {
+                      name = "strings",
+                      type = "table",
+                      description = "A table of colored strings, each given as a `{ color, string }` pair.  The color can be a `Vec3`, `Vec4`, table, or hexcode."
+                    },
+                    {
+                      name = "wrap",
+                      type = "number",
+                      description = "The maximum line length.  The units depend on the pixel density of the font, but are in meters by default.",
+                      default = "0"
+                    },
                     {
                     {
                       name = "halign",
                       name = "halign",
                       type = "HorizontalAlign",
                       type = "HorizontalAlign",

+ 5 - 1
api/lovr/graphics/Font/getVertices.lua

@@ -46,7 +46,11 @@ return {
   },
   },
   variants = {
   variants = {
     {
     {
-      arguments = { 'halign', 'valign' },
+      arguments = { 'string', 'wrap', 'halign', 'valign' },
+      returns = { 'vertices', 'material' }
+    },
+    {
+      arguments = { 'strings', 'wrap', 'halign', 'valign' },
       returns = { 'vertices', 'material' }
       returns = { 'vertices', 'material' }
     }
     }
   },
   },