Difference between revisions of "Sprite:getBounds"

(remove language stuff)
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Class:''' [[Sprite]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
+
 
=== <translate>Description</translate> ===
+
=== Description ===
<translate><br />
+
Returns a rectangle (as x, y, width and height) that encloses the sprite as it appears in another sprite coordinate system.
Returns a rectangle (as x, y, width and height) that encloses the sprite as it appears in another sprite's coordinate system.<br />
 
<br /></translate>
 
 
<source lang="lua">
 
<source lang="lua">
 
(number), (number), (number), (number) = Sprite:getBounds(targetSprite)
 
(number), (number), (number), (number) = Sprite:getBounds(targetSprite)
 
</source>
 
</source>
=== <translate>Parameters</translate> ===
+
 
'''targetSprite''': (Sprite) <translate>the sprite that defines the other coordinate system to transform</translate> <br/>
+
=== Parameters ===
=== <translate>Return values</translate> ===
+
'''targetSprite''': (Sprite) the sprite that defines the other coordinate system to transform<br/>
'''<translate>Returns</translate>''' (number) <translate>x coordinate</translate><br/>
+
 
'''<translate>Returns</translate>''' (number) <translate>y coordinate</translate><br/>
+
=== Return values ===
'''<translate>Returns</translate>''' (number) <translate>width of Sprite</translate><br/>
+
'''Returns''' (number) x coordinate<br/>
'''<translate>Returns</translate>''' (number) <translate>height of Sprite</translate><br/>
+
'''Returns''' (number) y coordinate<br/>
=== <translate>Examples</translate> ===
+
'''Returns''' (number) width of Sprite<br/>
'''Example'''<br/>
+
'''Returns''' (number) height of Sprite<br/>
<source lang="lua">local x, y, width, height = sprite:getBounds(sprite) -- returns local (untransformed) bounds
+
 
local x, y, width, height = sprite:getBounds(stage) -- returns bounds as transformed to the stage coordinate system</source>
+
=== Examples ===
 +
<source lang="lua">
 +
local x, y, width, height = sprite:getBounds(sprite) -- returns local (untransformed) bounds
 +
local x, y, width, height = sprite:getBounds(stage) -- returns bounds as transformed to the stage coordinate system
 +
</source>
  
 
{{Sprite}}
 
{{Sprite}}

Latest revision as of 23:44, 14 February 2021

Available since: Gideros 2011.6
Class: Sprite

Description

Returns a rectangle (as x, y, width and height) that encloses the sprite as it appears in another sprite coordinate system.

(number), (number), (number), (number) = Sprite:getBounds(targetSprite)

Parameters

targetSprite: (Sprite) the sprite that defines the other coordinate system to transform

Return values

Returns (number) x coordinate
Returns (number) y coordinate
Returns (number) width of Sprite
Returns (number) height of Sprite

Examples

local x, y, width, height = sprite:getBounds(sprite) -- returns local (untransformed) bounds
local x, y, width, height = sprite:getBounds(stage) -- returns bounds as transformed to the stage coordinate system