Difference between revisions of "Sprite"
(→Methods: added getDimensions and setDimensions) |
|||
Line 20: | Line 20: | ||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === | + | === Methods === |
[[Special:MyLanguage/Sprite.new|Sprite.new]] ''<translate>creates a new Sprite object</translate>''<br/><!-- GIDEROSMTD:Sprite.new() creates a new Sprite object --> | [[Special:MyLanguage/Sprite.new|Sprite.new]] ''<translate>creates a new Sprite object</translate>''<br/><!-- GIDEROSMTD:Sprite.new() creates a new Sprite object --> | ||
[[Special:MyLanguage/Sprite:addChild|Sprite:addChild]] ''<translate>adds a sprite as a child</translate>''<br/><!-- GIDEROSMTD:Sprite:addChild(child) adds a sprite as a child --> | [[Special:MyLanguage/Sprite:addChild|Sprite:addChild]] ''<translate>adds a sprite as a child</translate>''<br/><!-- GIDEROSMTD:Sprite:addChild(child) adds a sprite as a child --> | ||
Line 35: | Line 35: | ||
[[Special:MyLanguage/Sprite:getClip|Sprite:getClip]] <br/><!-- GIDEROSMTD:Sprite:getClip() --> | [[Special:MyLanguage/Sprite:getClip|Sprite:getClip]] <br/><!-- GIDEROSMTD:Sprite:getClip() --> | ||
[[Special:MyLanguage/Sprite:getColorTransform|Sprite:getColorTransform]] ''<translate>returns the red, green, blue and alpha channel multipliers</translate>''<br/><!-- GIDEROSMTD:Sprite:getColorTransform() returns the red, green, blue and alpha channel multipliers --> | [[Special:MyLanguage/Sprite:getColorTransform|Sprite:getColorTransform]] ''<translate>returns the red, green, blue and alpha channel multipliers</translate>''<br/><!-- GIDEROSMTD:Sprite:getColorTransform() returns the red, green, blue and alpha channel multipliers --> | ||
+ | [[Special:MyLanguage/Sprite:getDimensions|Sprite:getDimensions]] ''returns the width and height of the Sprite''<br/><!-- GIDEROSMTD:Sprite:getDimensions() returns the width and height of the Sprite --> | ||
[[Special:MyLanguage/Sprite:getDrawCount|Sprite:getDrawCount]] ''<translate>returns the number of Sprites actually drawn each frame on this subtree</translate>''<br/><!-- GIDEROSMTD:Sprite:getDrawCount() returns the number of Sprites actually drawn each frame on this subtree --> | [[Special:MyLanguage/Sprite:getDrawCount|Sprite:getDrawCount]] ''<translate>returns the number of Sprites actually drawn each frame on this subtree</translate>''<br/><!-- GIDEROSMTD:Sprite:getDrawCount() returns the number of Sprites actually drawn each frame on this subtree --> | ||
[[Special:MyLanguage/Sprite:getHeight|Sprite:getHeight]] ''<translate>returns the height</translate>''<br/><!-- GIDEROSMTD:Sprite:getHeight(withoutTransform) returns the height --> | [[Special:MyLanguage/Sprite:getHeight|Sprite:getHeight]] ''<translate>returns the height</translate>''<br/><!-- GIDEROSMTD:Sprite:getHeight(withoutTransform) returns the height --> | ||
Line 71: | Line 72: | ||
[[Special:MyLanguage/Sprite:setClip|Sprite:setClip]] ''<translate>Clip Sprite contents</translate>''<br/><!-- GIDEROSMTD:Sprite:setClip(x,y,width,height) Clip Sprite contents --> | [[Special:MyLanguage/Sprite:setClip|Sprite:setClip]] ''<translate>Clip Sprite contents</translate>''<br/><!-- GIDEROSMTD:Sprite:setClip(x,y,width,height) Clip Sprite contents --> | ||
[[Special:MyLanguage/Sprite:setColorTransform|Sprite:setColorTransform]] ''<translate>sets the red, green, blue and alpha channel multipliers</translate>''<br/><!-- GIDEROSMTD:Sprite:setColorTransform(redMultiplier,greenMultiplier,blueMultiplier,alphaMultiplier) sets the red, green, blue and alpha channel multipliers --> | [[Special:MyLanguage/Sprite:setColorTransform|Sprite:setColorTransform]] ''<translate>sets the red, green, blue and alpha channel multipliers</translate>''<br/><!-- GIDEROSMTD:Sprite:setColorTransform(redMultiplier,greenMultiplier,blueMultiplier,alphaMultiplier) sets the red, green, blue and alpha channel multipliers --> | ||
+ | [[Special:MyLanguage/Sprite:setDimensions|Sprite:setDimensions]] ''sets the width and height of the Sprite''<br/><!-- GIDEROSMTD:Sprite:setDimensions() sets the width and height of the Sprite --> | ||
[[Special:MyLanguage/Sprite:setLayoutConstraints|Sprite:setLayoutConstraints]] ''<translate>specify the child placement constraints for Gideros's layout system</translate>''<br/><!-- GIDEROSMTD:Sprite:setLayoutConstraints(constraints) specify the child placement constraints for Gideros's layout system --> | [[Special:MyLanguage/Sprite:setLayoutConstraints|Sprite:setLayoutConstraints]] ''<translate>specify the child placement constraints for Gideros's layout system</translate>''<br/><!-- GIDEROSMTD:Sprite:setLayoutConstraints(constraints) specify the child placement constraints for Gideros's layout system --> | ||
[[Special:MyLanguage/Sprite:setLayoutParameters|Sprite:setLayoutParameters]] ''<translate>specify the parent parameters for Gideros's layout system</translate>''<br/><!-- GIDEROSMTD:Sprite:setLayoutParameters(layout) specify the parent parameters for Gideros's layout system --> | [[Special:MyLanguage/Sprite:setLayoutParameters|Sprite:setLayoutParameters]] ''<translate>specify the parent parameters for Gideros's layout system</translate>''<br/><!-- GIDEROSMTD:Sprite:setLayoutParameters(layout) specify the parent parameters for Gideros's layout system --> |
Revision as of 00:44, 21 August 2020
Supported platforms:
Available since: Gideros 2011.6
Inherits from: EventDispatcher
Description
The Sprite class is the base class for all objects that can be placed on the scene tree. It is the basic scene tree building block.
A sprite can contain child sprites which makes the scene tree hierarchy. Transformations such as translation, rotation, scaling, and color transforms, propagate its effect to all of its children.
The drawing order is defined by the order of children. The first child is drawn first and the last child is drawn last. It is possible to change the drawing order by modifying the order of child list.
A Sprite instance can exist without attaching the scene tree.
An unattached sprite can receive Event.ENTER_FRAME event but it will only receive mouse and touch events when it is attached to the scene tree.
MethodsSprite.new creates a new Sprite object |
EventsEvent.ADDED_TO_STAGE ConstantsSprite.ADD |