Difference between revisions of "Sprite:getBounds"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''Available since:''' Gideros 2011.6<br/>
+
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
=== Description ===
+
=== <translate>Description</translate> ===
 
<translate><br />
 
<translate><br />
 
Returns a rectangle (as x, y, width and height) that encloses the sprite as it appears in another sprite's coordinate system.<br />
 
Returns a rectangle (as x, y, width and height) that encloses the sprite as it appears in another sprite's coordinate system.<br />
Line 8: Line 8:
 
(number), (number), (number), (number) = Sprite:getBounds(targetSprite)
 
(number), (number), (number), (number) = Sprite:getBounds(targetSprite)
 
</source>
 
</source>
=== Parameters ===
+
=== <translate>Parameters</translate> ===
 
'''targetSprite''': (Sprite) <translate>the sprite that defines the other coordinate system to transform</translate> <br/>
 
'''targetSprite''': (Sprite) <translate>the sprite that defines the other coordinate system to transform</translate> <br/>
=== Return values ===
+
=== <translate>Return values</translate> ===
'''Returns''' (number) <translate>x coordinate</translate><br/>
+
'''<translate>Returns</translate>''' (number) <translate>x coordinate</translate><br/>
'''Returns''' (number) <translate>y coordinate</translate><br/>
+
'''<translate>Returns</translate>''' (number) <translate>y coordinate</translate><br/>
'''Returns''' (number) <translate>width of Sprite</translate><br/>
+
'''<translate>Returns</translate>''' (number) <translate>width of Sprite</translate><br/>
'''Returns''' (number) <translate>height of Sprite</translate><br/>
+
'''<translate>Returns</translate>''' (number) <translate>height of Sprite</translate><br/>
=== Examples ===
+
=== <translate>Examples</translate> ===
 
'''Example'''<br/>
 
'''Example'''<br/>
 
<source lang="lua">local x, y, width, height = sprite:getBounds(sprite) -- returns local (untransformed) bounds
 
<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 stage&#039;s coordinate system</source>
 
local x, y, width, height = sprite:getBounds(stage) -- returns bounds as transformed to stage&#039;s coordinate system</source>

Revision as of 08:29, 24 August 2018

Available since: Gideros 2011.6

Description


Returns a rectangle (as x, y, width and height) that encloses the sprite as it appears in another sprite's 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

Example

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 stage&#039;s coordinate system