Browse Source

lovr.graphics.fill gets uv coordinates;

bjorn 6 years ago
parent
commit
6a84d25140
2 changed files with 70 additions and 2 deletions
  1. 48 0
      api/init.lua
  2. 22 2
      api/lovr/graphics/fill.lua

+ 48 - 0
api/init.lua

@@ -7277,6 +7277,30 @@ return {
                   name = "texture",
                   type = "Texture",
                   description = "The texture to use."
+                },
+                {
+                  name = "u",
+                  type = "number",
+                  description = "The x component of the uv offset.",
+                  default = "0"
+                },
+                {
+                  name = "v",
+                  type = "number",
+                  description = "The y component of the uv offset.",
+                  default = "0"
+                },
+                {
+                  name = "w",
+                  type = "number",
+                  description = "The width of the Texture to render, in uv coordinates.",
+                  default = "1 - u"
+                },
+                {
+                  name = "h",
+                  type = "number",
+                  description = "The height of the Texture to render, in uv coordinates.",
+                  default = "1 - v"
                 }
               },
               returns = {}
@@ -7288,6 +7312,30 @@ return {
                   name = "canvas",
                   type = "Canvas",
                   description = "The first Texture attached to this Canvas will be used."
+                },
+                {
+                  name = "u",
+                  type = "number",
+                  description = "The x component of the uv offset.",
+                  default = "0"
+                },
+                {
+                  name = "v",
+                  type = "number",
+                  description = "The y component of the uv offset.",
+                  default = "0"
+                },
+                {
+                  name = "w",
+                  type = "number",
+                  description = "The width of the Texture to render, in uv coordinates.",
+                  default = "1 - u"
+                },
+                {
+                  name = "h",
+                  type = "number",
+                  description = "The height of the Texture to render, in uv coordinates.",
+                  default = "1 - v"
                 }
               },
               returns = {}

+ 22 - 2
api/lovr/graphics/fill.lua

@@ -10,18 +10,38 @@ return {
     canvas = {
       type = 'Canvas',
       description = 'The first Texture attached to this Canvas will be used.'
+    },
+    u = {
+      type = 'number',
+      default = '0',
+      description = 'The x component of the uv offset.'
+    },
+    v = {
+      type = 'number',
+      default = '0',
+      description = 'The y component of the uv offset.'
+    },
+    w = {
+      type = 'number',
+      default = '1 - u',
+      description = 'The width of the Texture to render, in uv coordinates.'
+    },
+    h = {
+      type = 'number',
+      default = '1 - v',
+      description = 'The height of the Texture to render, in uv coordinates.'
     }
   },
   returns = {},
   variants = {
     {
       description = 'Fills the screen with a Texture.',
-      arguments = { 'texture' },
+      arguments = { 'texture', 'u', 'v', 'w', 'h' },
       returns = {}
     },
     {
       description = 'Fills the screen with the first Texture attached to a Canvas.',
-      arguments = { 'canvas' },
+      arguments = { 'canvas', 'u', 'v', 'w', 'h' },
       returns = {}
     },
     {