Pooka SDK API Reference
Sprite Class Reference

#include <Sprite.h>

+ Inheritance diagram for Sprite:
+ Collaboration diagram for Sprite:

Detailed Description

A class represents a 2D graphics element in Pooka SDK® application content.

In Pooka SDK®, Sprite is the lowest-level 2D content node, means it is ultimate 2D object presented in 2D content. Sprite's direct container is SceneSprite. The following picture shows sprites (by purple boxes) in Pooka SDK® application hierarchical structure

Remarks  Sprite Appearance Properties
Sprite provides large amount of class properties to describe a Sprite appearance. The property combination can generate a vast diversity in Sprite's appearance.
Some of the appearance properties share certain similarities to those defined in CSS (Cascading Style Sheets).

Caution Although some Sprite properties are loosely inspired by CSS properties, there is by no means an one-to-one mapping between them and developers should always refer to Pooka SDK® API reference to get the precise meaning of each Sprite properties.

Remarks  Static Sprite vs Interactive Sprite
There are two kinds of Sprite in Pooka SDK® application: static sprites and interactive sprites. Static sprites can only display certain types of information through its text or texture whereas they do not respond to user operations. Interactive sprites, on the other hand, are sprites that can respond to user operations and are UI elements involved in user inter-activities. The property guiType and enumeration GUI_SPRITE_TYPE work together to determine whether a Sprite is a static Sprite or interactive Sprite.

The enumeration type GUI_STATIC defines a static Sprite, that is means this Sprite does not respond to use input (such as mouse or keyboard) and is only used to display some kinds of static information. All other types defines an interactive Sprite.

 Note  None of the GUI_SPRITE_TYPE type will change the Sprite's look unless the Sprite is themed (see setThemeType). For non-themed sprites, it is developers' responsibility to control the their appearance by properties defined in Sprite class.

See also
guiType
GUI_SPRITE_TYPE

Remarks  Un-themed Sprite vs Themed Sprite
In Pooka SDK®, a Sprite can be un-themed (by default) or themed:

See also
themeType
SpriteTheme::THEME_GUI_TYPE
SpriteTheme
GraphicsApp::OGApplication::setAppTheme
GraphicsApp::OGApplication::getAppTheme

Remarks  Sprites Maintains a Value
Certain types of interactive Sprite can maintain a value. During the application session, the value maintained by sprite may be changed by user operation. For example, the text value of a edit-box sprite can be changed after user editing.

guiType Meaning of the Maintained Value
check-box GUI_CHECKBOX Whether the check-box is checked
radio-button GUI_CHECKBOX
(check-box is turned into radio-button when they are grouped together)
Whether the radio-button is selected
edit-box GUI_EDITBOX
(edit-box can also appear to be password field)
The text value

Under certain situations, developers may want to persist the sprite's value across multiple application sessions, there are two options:

  • Developers implement the persistence logic on their own, i.e., save the modified value before application's at the end of current session and load the saved value at the beginning of the new session.
  • Set sprite property persistent to True to make the value persistence done by GUI::OGCanvas automatically.
See also
persistent
GUI::OGCanvas

Remarks  Interactive Sprite vs LWComponent
While a single interactive sprite is capable for certain simple user operations, it can not undertake complicated job, such as a calculator, a color picker, or even a simple drop-down list-box. In this case, a group of sprites work together to compose a UI component to fulfill a complicated task. In order to make these sprite groups reusable, Pooka SDK® provides a class LWComponent help generate light-weight, moduled, fully reusable component that can help easily construct UI for complicated user operations.

See also
GUI::Component::LWComponent

Classes

class  DraggingListener
 
class  EditBoxVerificationListener
 
class  RenderListener
 

Public Types

enum  GUI_SPRITE_TYPE {
  GUI_STATIC = 0, GUI_BUTTON = 1, GUI_CHECKBOX = 2, GUI_HYPERLINK = 3,
  GUI_TIPLINK = 4, GUI_EDITBOX = 5, GUI_LWCOMPONENT = 6
}
 
enum  TEXT_ALIGNMENT_MODE { ALIGN_LEFT = -1, ALIGN_CENTER = 0, ALIGN_RIGHT = +1 }
 
enum  TEXT_V_ALIGNMENT_MODE { ALIGN_V_TOP = -1, ALIGN_V_MIDDLE = 0, ALIGN_V_BOTTOM = +1 }
 
enum  POSITION_ANCHORPOINT_TYPE {
  ANCHOR_LEFT_TOP = 0, ANCHOR_RIGHT_TOP = 1, ANCHOR_LEFT_BOTTOM = 2, ANCHOR_RIGHT_BOTTOM = 3,
  ANCHOR_TOP_CENTER = 4, ANCHOR_BOTTOM_CENTER = 5, ANCHOR_LEFT_CENTER = 6, ANCHOR_RIGHT_CENTER = 7,
  ANCHOR_CENTER = 8
}
 
enum  POSITION_NEXT_TO_TYPE { RIGHT_NEXT_TO = 0, UP_NEXT_TO = 1, LEFT_NEXT_TO = 2, DOWN_NEXT_TO = 3 }
 
enum  EDITBOX_INPUT_TYPES {
  EDITBOX_NATURAL_NUMBER = 0, EDITBOX_WHOLE_NUMBER = 1, EDITBOX_INTEGER = 2, EDITBOX_REAL_NUMBER = 3,
  EDITBOX_ALPHANUMERIC = 4, EDITBOX_ANYTHING = 5
}
 
- Public Types inherited from Group
enum  GROUP_TYPE { GROUP_SPRITE = 0, GROUP_3D = 1 }
 
enum  CREATION_TYPE { ORIGINAL_GROUP = 0, CLONED_GROUP = 1 }
 
enum  GROUP_STATE { STATE_NORMAL = 0, STATE_ACTIVE = 1 }
 
- Public Types inherited from Asset
enum  ASSET_TYPE { ASSET_UNKNOWN = -1, ASSET_TEXTURE = 0, ASSET_SOUND = 1, ASSET_3DMODEL = 2 }
 
enum  CONSTRUCTION_TYPE { CONSTRUCTED_PROGRAMMATICALLY = 0, LOADED_FROM_APP_ASSET = 1 }
 

Public Member Functions

 Sprite (int x=0, int y=0, int width=-1, int height=-1)
 
 Sprite (const Sprite &another)
 
virtual ~Sprite ()
 
virtual SpritegetClone ()
 
virtual void set (Sprite *another)
 
void setSize (int width, int height)
 
void setPosition (int x, int y)
 
void setDimension (int x, int y, int width, int height)
 
void setSizePT (int width, int height)
 
void setPositionPT (int x, int y)
 
void setDimensionPT (int x, int y, int width, int height)
 
void setSizeByRef (int xPercentOrExpansion, int yPercentOrExpansion, int reference, int sizingMode, Sprite *anotherSprite=0)
 
void setPositionByRef (int xGapOrOffset, int yGapOrOffset, int reference, int positioningMode, Sprite *anotherSprite=0)
 
void setPositionNextToRef (Sprite *anotherSprite, int positioningMode, int distance)
 
void getAnchorPosition (int anchorType, MiniSTL::Type::OGPoint *position)
 
void setText (wchar_t *text, bool ignoreEscapeCodeInText=false)
 
wchar_t * getText ()
 
void setThemeType (int themeType)
 
int getThemeType ()
 
void getUnformattedTextSize (MiniSTL::Type::OGSize *textSize, int state=Group::STATE_NORMAL, MiniAWT::Graphics::BitmapFont *assumedBitmapFont=0)
 
void setTextures (Texture *texture, Texture *textureBright, int clipX=-1, int clipY=-1, int clipW=-1, int clipH=-1)
 
void setHyperLinkDestination (wchar_t *href)
 
wchar_t * getHyperLinkDestination ()
 
void setSpriteEditBoxAttribute (wchar_t *attribName, int attribValue)
 
int getSpriteEditBoxAttribute (wchar_t *attribName)
 
bool setNavigationIndex (wchar_t numericIndex, wchar_t alphabeticIndex, wchar_t specialIndex=0)
 
void setIndexTokenOffset (int offsetX, int offsetY)
 
int getIndexTokenOffsetX ()
 
int getIndexTokenOffsetY ()
 
- Public Member Functions inherited from Group
void setName (wchar_t *name)
 
wchar_t * getName ()
 
virtual ~Group ()
 
- Public Member Functions inherited from Asset
virtual ~Asset ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
void addRef ()
 
void release ()
 
virtual wchar_t * toString ()
 
wchar_t * getClassName (bool keepNameSpace=false)
 
void syncBegin ()
 
void syncEnd ()
 
void wait (unsigned int timeout=0xFFFFFFFF)
 
void notify ()
 
void notifyAll ()
 

Public Attributes

int x
 
int y
 
int z
 
int width
 
int height
 
int color
 
int colorBright
 
int colorTransparency
 
int outlineColor
 
int frameColor
 
int frameColorBright
 
int frameBevel
 
int frameBevelBright
 
int frameThickness
 
bool frameAsUnderline
 
int cornerCut
 
int anchorPoint
 
int textSize
 
bool textBold
 
bool textItalic
 
bool textUnderline
 
int textColor
 
int textColorBright
 
int textTransparency
 
int textShadow
 
int textShadowTransparency
 
bool textFormatted
 
int textAlignment
 
int textVAlignment
 
int textPadding
 
int textLineSpacing
 
int textOffsetX
 
int textOffsetY
 
bool useMonoFont
 
MiniAWT::Graphics::BitmapFontbitmapFont
 
MiniAWT::Graphics::BitmapFontbitmapFontBright
 
Texturetexture
 
TexturetextureBright
 
int textureTransparency
 
bool textureTiling
 
int textureOutputW
 
int textureOutputH
 
int textureOffsetX
 
int textureOffsetY
 
int textureClipX
 
int textureClipY
 
int textureClipW
 
int textureClipH
 
int textureAlignment
 
float textureRotation
 
float textureRotationAnchorX
 
float textureRotationAnchorY
 
int textureLeftEdgeInset
 
int textureRightEdgeInset
 
int textureTopEdgeInset
 
int textureBottomEdgeInset
 
int guiType
 
bool tabStop
 
bool enabled
 
int pickingExtensionX
 
int pickingExtensionY
 
bool draggable
 
bool repeatMouseClicking
 
int clickingRepeatInterval
 
int clickingRepeatFirstTimeInterval
 
bool persistent
 
RenderListenerrenderListener
 
DraggingListenerdraggingListener
 
EditBoxVerificationListenereditBoxVerificationListener
 
- Public Attributes inherited from Group
bool visible
 
int type
 
int state
 
wchar_t name [65]
 
Scenecontainer
 
int creationType
 
- Public Attributes inherited from Asset
void * userDefined
 
int constructionType
 

Static Public Attributes

static wchar_t * EDITBOX_ATTR_MULTI_LINE
 
static wchar_t * EDITBOX_ATTR_MAX_LENGTH
 
static wchar_t * EDITBOX_ATTR_INPUT_TYPE
 
static wchar_t * EDITBOX_ATTR_ALLOW_EMPTY
 
static wchar_t * EDITBOX_ATTR_READ_ONLY
 
static wchar_t * EDITBOX_ATTR_SHOW_AS_PASSWORD
 

Additional Inherited Members

- Protected Member Functions inherited from Group
 Group ()
 
- Protected Member Functions inherited from Asset
 Asset ()
 

Member Enumeration Documentation

§ GUI_SPRITE_TYPE

Enumeration defines the GUI (graphical user interface) type of a Sprite.

Sprite's GUI type tells the role of a Sprite in user interface. For example, some sprites are used to generate a click-able button, a check-box or a hyper-link, these types of Sprite are referred to as interactive sprites; On the other side, some sprites may be used just as static UI elements that only shows some kinds of information, such as a text box, a label or a picture.

See Static Sprite vs Interactive Sprite for more details.

Enumerator
GUI_STATIC 

A static UI element used to show static content such as text, picture, information, etc.

GUI_BUTTON 

An interactive Sprite used as an interactive button

GUI_CHECKBOX 

An interactive Sprite used as a interactive check-box

GUI_HYPERLINK 

An interactive Sprite used as a click-able hyper-link

GUI_TIPLINK 

An interactive Sprite used as a click-able tip-link

GUI_EDITBOX 

An interactive Sprite used as a edit-box for text input

GUI_LWCOMPONENT 

An interactive Sprite used as an interactive light-weight component

§ TEXT_ALIGNMENT_MODE

Enumeration defines the text horizontal alignment mode, the default mode is ALIGH_LEFT.

The default value if ALIGN_LEFT.

Enumerator
ALIGN_LEFT 

Text horizontal left-aligned mode.

ALIGN_CENTER 

Text horizontal center-aligned mode.

ALIGN_RIGHT 

Text horizontal right-aligned mode.

§ TEXT_V_ALIGNMENT_MODE

Enumeration defines the text vertical alignment mode, the default mode is ALIGN_V_TOP.

The default value if ALIGN_V_TOP.

Enumerator
ALIGN_V_TOP 

Text vertical top-aligned mode.

ALIGN_V_MIDDLE 

Text vertical middle-aligned mode.

ALIGN_V_BOTTOM 

Text vertical bottom-aligned mode.

§ POSITION_ANCHORPOINT_TYPE

Enumeration defines the anchor point types

The anchor point determines the geometrical origin of a Sprite. The anchor type has effect on the following things:

  • How a Sprite is positioned: a Sprite positioned at (x, y) actually means its anchor point is positioned precisely at (x, y) in container SceneSprite's local coordinate system.
  • How a Sprite is rotated: a Sprite is rotated around its anchor point.
  • How a Sprite is relatively aligned by reference:a Sprite is relatively aligned by reference with its anchor point aligned to the reference

This enumeration is also used by property textureAlignment, which determines how Sprite's texture is aligned with Sprite when it is rendered. See textureAlignment for more details.

Enumerator
ANCHOR_LEFT_TOP 

Anchor point is at the left-top corner of the Sprite's bounding box.

ANCHOR_RIGHT_TOP 

Anchor point is at the right-top corner of the Sprite's bounding box.

ANCHOR_LEFT_BOTTOM 

Anchor point is at the left-bottom corner of the Sprite's bounding box.

ANCHOR_RIGHT_BOTTOM 

Anchor point is at the right-bottom corner of the Sprite's bounding box.

ANCHOR_TOP_CENTER 

Anchor point is at the top-side-center of the Sprite's bounding box.

ANCHOR_BOTTOM_CENTER 

Anchor point is at the bottom-side-center of the Sprite's bounding box.

ANCHOR_LEFT_CENTER 

Anchor point is at the left-side-center of the Sprite's bounding box.

ANCHOR_RIGHT_CENTER 

Anchor point is at the right-side-center of the Sprite's bounding box.

ANCHOR_CENTER 

Anchor point is at the center of the Sprite's bounding box.

§ POSITION_NEXT_TO_TYPE

Enumeration defines the position-by-reference mode when position a Sprite by another reference Sprite.

Enumerator
RIGHT_NEXT_TO 

The target Sprite is on the right next to the reference Sprite.

UP_NEXT_TO 

The target Sprite is above and next to the reference Sprite.

LEFT_NEXT_TO 

The target Sprite is on the left next to the reference Sprite.

DOWN_NEXT_TO 

The target Sprite is under and next to the reference Sprite.

§ EDITBOX_INPUT_TYPES

Values that represent the input type of a edit-box Sprite.

See also
setSpriteEditBoxAttribute
getSpriteEditBoxAttribute
Enumerator
EDITBOX_NATURAL_NUMBER 

Indicates the sprite-editbox accepts natural numbers, including number 0.

EDITBOX_WHOLE_NUMBER 

Indicates the sprite-editbox accepts [whole numbers] (positive integer)](https://en.wikipedia.org/wiki/List_of_types_of_numbers).

EDITBOX_INTEGER 

Indicates the sprite-editbox accepts integer.

EDITBOX_REAL_NUMBER 

Indicates the sprite-editbox accepts real numbers.

EDITBOX_ALPHANUMERIC 

Indicates the sprite-editbox accepts POSIX/C Alphanumeric characters.

EDITBOX_ANYTHING 

Indicates the sprite-editbox accepts any characters.

Constructor & Destructor Documentation

§ Sprite() [1/2]

Sprite ( int  x = 0,
int  y = 0,
int  width = -1,
int  height = -1 
)

Constructor.

Parameters
xThe x coordinate of the Sprite defined in container SceneSprite's coordinate system, in pixels
yThe y coordinate of the Sprite defined in container SceneSprite's coordinate system, in pixels
widthThe width of the Sprite in pixels
heightThe height of the Sprite in pixels

§ Sprite() [2/2]

Sprite ( const Sprite another)

Copy constructor.

Parameters
anotherAnother sprite

§ ~Sprite()

virtual ~Sprite ( )
virtual

Destructor.

Member Function Documentation

§ getClone()

virtual Sprite& getClone ( )
virtual

Gets a clone of this Sprite and return the reference to the caller.

Returns
The clone of this Sprite

Reimplemented in TokenSprite.

§ set()

virtual void set ( Sprite another)
virtual

Sets all the properties of this Sprite by another Sprite.

Parameters
anotherAnother Sprite

§ setSize()

void setSize ( int  width,
int  height 
)

Sets the size of this Sprite.

 Tip  This is a convenience function to set the size of this Sprite. It can also be done by setting value of width and height directly.
See illustration

Parameters
widthThe desired width of this Sprite, in pixels
heightThe desired height of this Sprite, in pixels
See also
width
height

§ setPosition()

void setPosition ( int  x,
int  y 
)

Sets the position of this Sprite.

 Tip  This is a convenience function to set the position of this Sprite. It can also be done by setting value of x and y directly.
See illustration

Parameters
xThe x coordinate of this Sprite, in pixels
yThe y coordinate of this Sprite, in pixels
See also
x
y

§ setDimension()

void setDimension ( int  x,
int  y,
int  width,
int  height 
)

Sets the size and position of this Sprite.

 Tip  This is a convenience function to set the size and position of this Sprite. It can also be done by setting value of x, y, width and height directly.
See illustration

Parameters
xThe x coordinate of this Sprite, in pixels
yThe y coordinate of this Sprite, in pixels
widthThe desired width of this Sprite, in pixels
heightThe desired height of this Sprite, in pixels
See also
x
y
width
height

§ setSizePT()

void setSizePT ( int  width,
int  height 
)

Sets the size of this Sprite.

 Tip  This is a convenience function to set the size of this Sprite. It can also be done by setting value of width and height directly.
See illustration

Parameters
widthThe desired width of this Sprite, in points
heightThe desired height of this Sprite, in points
See also
MiniAWT::Content::pointToPixel
width
height

§ setPositionPT()

void setPositionPT ( int  x,
int  y 
)

Sets the position of this Sprite.

 Tip  This is a convenience function to set the position of this Sprite. It can also be done by setting value of x and y directly.
See illustration

Parameters
xThe x coordinate of this Sprite, in points
yThe y coordinate of this Sprite, in points
See also
MiniAWT::Content::pointToPixel
x
y

§ setDimensionPT()

void setDimensionPT ( int  x,
int  y,
int  width,
int  height 
)

Sets the size and position of this Sprite.

 Tip  This is a convenience function to set the size and position of this Sprite. It can also be done by setting value of x, y, width and height directly.
See illustration

Parameters
xThe x coordinate of this Sprite, in points
yThe y coordinate of this Sprite, in points
widthThe desired width of this Sprite, in points
heightThe desired height of this Sprite, in points
See also
MiniAWT::Content::pointToPixel
x
y
width
height

§ setSizeByRef()

void setSizeByRef ( int  xPercentOrExpansion,
int  yPercentOrExpansion,
int  reference,
int  sizingMode,
Sprite anotherSprite = 0 
)

Sets size of this Sprite by a reference.

This function sets the size of this Sprite by a reference, which can be:

The size is determined by the reference and the sizing mode, refer to SceneGraph::Scene::POSITION_AND_SIZE_MODE for more details.

Depends on the argument sizingMode, the first two arguments are used either as percent or expansion (in pixels) relative to the reference.

  • If argument sizingMode is SceneGraph::Scene::RELATIVE_SIZE_BY_PIXEL: the new size is equal to the reference's size plus applying an expansion specified by arguments xPercentOrExpansion and yPercentOrExpansion.
     Note  Positive value means expansion, negative value means contraction.
  • If argument sizingMode is SceneGraph::Scene::RELATIVE_SIZE_BY_PERCENTAGE: the new size is determined by a percentage value specified by arguments xPercentOrExpansion and yPercentOrExpansion relative to the reference's size

Parameters
xPercentOrExpansionThe horizontal percent or expansion, relative to the reference.
yPercentOrExpansionThe vertical percent or expansion, relative to the reference.
referenceThe reference type, must be one of constants defined in SceneGraph::Scene::POSITION_AND_SIZE_REFERENCE.
sizingModeThe sizing mode, must be one of constants defined in SceneGraph::Scene::POSITION_AND_SIZE_MODE.
anotherSpriteAnother Sprite as the reference, only used when the argument reference has value equal to SceneGraph::Scene::RELATIVE_TO_SPRITE.

§ setPositionByRef()

void setPositionByRef ( int  xGapOrOffset,
int  yGapOrOffset,
int  reference,
int  positioningMode,
Sprite anotherSprite = 0 
)

Sets position of this Sprite by a reference.

This function sets the position of this Sprite by a reference, which can be:

The position is determined by the reference and the positioning mode, refer SceneGraph::Scene::POSITION_AND_SIZE_MODE for more details.

Depends on the argument positioningMode, the first two arguments are used either as offset (in pixels) or gap (in pixels) relative to one border of the reference.

How Relative Position Determined How Arguments Gap/Offset Applied
RELATIVE_POS_CENTER newX: horizontally centered to the reference
newY: vertically centered to the reference
xGapOrOffset:applied as offset
yGapOrOffset:applied as offset
RELATIVE_POS_H_CENTER newX: horizontally centered to the reference
newY: remained unchanged
xGapOrOffset:applied as offset
yGapOrOffset:applied as offset
RELATIVE_POS_V_CENTER newX: remained unchanged
newY: vertically centered to the reference
xGapOrOffset:applied as offset
yGapOrOffset:applied as offset
RELATIVE_POS_LEFT newX: left-aligned to the reference
newY: remained unchanged
xGapOrOffset:applied as gap
yGapOrOffset:applied as offset
RELATIVE_POS_RIGHT newX: right-aligned to the reference
newY: remained unchanged
xGapOrOffset:applied as gap
yGapOrOffset:applied as offset
RELATIVE_POS_TOP newX: remained unchanged
newY: top-aligned to the reference
xGapOrOffset:applied as offset
yGapOrOffset:applied as gap
RELATIVE_POS_BOTTOM newX: remained unchanged
newY: bottom-aligned to the reference
xGapOrOffset:applied as offset
yGapOrOffset:applied as gap
RELATIVE_POS_LEFTTOP newX: left-aligned to the reference
newY: top-aligned to the reference
xGapOrOffset:applied as gap
yGapOrOffset:applied as gap
RELATIVE_POS_RIGHTTOP newX: right-aligned to the reference
newY: top-aligned to the reference
xGapOrOffset:applied as gap
yGapOrOffset:applied as gap
RELATIVE_POS_LEFTBOTTOM newX: left-aligned to the reference
newY: bottom-aligned to the reference
xGapOrOffset:applied as gap
yGapOrOffset:applied as gap
RELATIVE_POS_RIGHTBOTTOM newX: right-aligned to the reference
newY: bottom-aligned to the reference
xGapOrOffset:applied as gap
yGapOrOffset:applied as gap
RELATIVE_POS_LEFTCENTER newX: left-aligned to the reference
newY: vertically centered to the reference
xGapOrOffset:applied as offset
yGapOrOffset:applied as gap
RELATIVE_POS_RIGHTCENTER newX: right-aligned to the reference
newY: vertically centered to the reference
xGapOrOffset:applied as offset
yGapOrOffset:applied as gap
RELATIVE_POS_TOPCENTER newX: horizontally centered to the reference
newY: top-aligned to the reference
xGapOrOffset:applied as gap
yGapOrOffset:applied as offset
RELATIVE_POS_BOTTOMCENTER newX: horizontally centered to the reference
newY: bottom-aligned to the reference
xGapOrOffset:applied as gap
yGapOrOffset:applied as offset

Parameters
xGapOrOffsetThe horizontal offset or gap applied to the final position, in pixels.
yGapOrOffsetThe vertical offset or gap applied to the final position, in pixels.
referenceThe reference type, must be one of constants defined in SceneGraph::Scene::POSITION_AND_SIZE_REFERENCE.
positioningModeThe positioning mode, must be one of constants defined in SceneGraph::Scene::POSITION_AND_SIZE_MODE.
anotherSpriteAnother Sprite as the reference, only used when the argument reference has value equal to SceneGraph::Scene::RELATIVE_TO_SPRITE.

§ setPositionNextToRef()

void setPositionNextToRef ( Sprite anotherSprite,
int  positioningMode,
int  distance 
)

Sets position of this Sprite by another reference Sprite.

The position is determined by the reference Sprite and the positioning mode, which must be one of constants defined in enumeration POSITION_NEXT_TO_TYPE. The following chart shows the meaning of each positioning modes:

How Relative Position Determined
LEFT_NEXT_TO The target Sprite is on the left next to the reference Sprite
RIGHT_NEXT_TO The target Sprite is on the right next to the reference Sprite
UP_NEXT_TO The target Sprite is above and next to the reference Sprite
DOWN_NEXT_TO The target Sprite is under and next to the reference Sprite

Parameters
anotherSpriteAnother Sprite as the reference
positioningModeThe positioning mode, must be one of constants defined in POSITION_NEXT_TO_TYPE
distanceThe distance between this Sprite and thereference Sprite, in pixels.

§ getAnchorPosition()

void getAnchorPosition ( int  anchorType,
MiniSTL::Type::OGPoint position 
)

Gets this Sprite's anchor position in container SceneSprite's coordinate system, in pixels.

This function calculates anchor point position with a specified anchor point type, the result is the coordinate in container SceneSprite's coordinate system, in pixels.

Parameters
anchorTypeThe desired anchor point type, must be one of constants defined in POSITION_ANCHORPOINT_TYPE.
positionAn OGPoint used to return the anchor position.

§ setText()

void setText ( wchar_t *  text,
bool  ignoreEscapeCodeInText = false 
)

Sets the Sprite's text

The argument text can contains any characters including the reserved OGTemplate separator characters and there is no need to use escape character to encode them. However, if text attribute is assigned by OGTemplate , then reserved separator tokens must be encoded by escape characters, see OGTemplate - Loading Sprite for more details.
For example, the following two lines of code assign the same text to the target sprite:

pSprite->setText(L"Personal [A]: Hello, How are you?");
pSprite->setText(L"Personal [A]^c Hello^cm How are you?");
Application::printf(L"pSprite's text is:%s\n", pSprite->getText());

As the result, the target sprite's text is assigned as Personal [A]: Hello, How are you?. If the argument ignoreEscapeCodeInText is set to True, then the code

pSprite->setText(L"Personal [A]^c Hello^cm How are you?");

will simply do the straight text copy on the target sprite, then the result will be Personal [A]^c Hello^cm How are you?, which might be wrong.

Parameters
textThe desired text set to this Sprite, specified by a C string
ignoreEscapeCodeInTextTrue to ignore escape character in the passed-in text, simply assign it to the Sprite.

§ getText()

wchar_t* getText ( )

Gets the Sprite's text

Returns
The Sprite's text returned as a C string

§ setThemeType()

void setThemeType ( int  themeType)

Sets the theme type of this Sprite.

See Un-themed Sprite vs Themed Sprite for more details.

Parameters
themeTypeThe theme type, must be one of constants defined in SpriteTheme::THEME_GUI_TYPE.
See also
SpriteTheme::THEME_GUI_TYPE
SpriteTheme
GraphicsApp::OGApplication::setAppTheme
GraphicsApp::OGApplication::getAppTheme

§ getThemeType()

int getThemeType ( )

Gets the theme type of this Sprite.

Returns
The theme type, must be one of constants defined in SpriteTheme::THEME_GUI_TYPE.

§ getUnformattedTextSize()

void getUnformattedTextSize ( MiniSTL::Type::OGSize textSize,
int  state = Group::STATE_NORMAL,
MiniAWT::Graphics::BitmapFont assumedBitmapFont = 0 
)

Gets the size of Sprite's text without the text format ignored.

This function retrieves the size of Sprite's text with related properties in this Sprite, such as textSize, bitmapFont. However, all the format related properties like textFormatted, textAlignment are ignored. The retrieved size (in pixels) is equal to the size of a "bounding box" contains the rendered Sprite's text with condition that the text is rendered in a single line and without any formatting.

Parameters
textSizeThe size of "bounding box" contains the rendered Sprite's text.
stateThe state of the Sprite, must be one of constants defined in SceneGraph::Group::state. The default value is SceneGraph::Group::STATE_NORMAL, means normal state.
assumedBitmapFontAn assumed BitmapFont given to this Sprite when calculate the size.

§ setTextures()

void setTextures ( Texture texture,
Texture textureBright,
int  clipX = -1,
int  clipY = -1,
int  clipW = -1,
int  clipH = -1 
)

Sets the textures of this Sprite.

 Tip  This is a convenience function to set the textures of this Sprite. It can also be done by setting value of texture and textureBright directly.

Parameters
textureThe texture used when the Sprite is under "normal" state (The Sprite's state is STATE_NORMAL ).
textureBrightThe texture used when the Sprite is under "active" state (The Sprite's state is STATE_ACTIVE ).
clipXThe X coordinate of texture's clipping window, see textureClipX for more details.
clipYThe Y coordinate of texture's clipping window, see textureClipY for more details.
clipWThe width of texture's clipping window, see textureClipW for more details.
clipHThe height of texture's clipping window, see textureClipH for more details.
See also
texture
textureBright
texture
textureClipX
textureClipY
textureClipW
textureClipH
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ setHyperLinkDestination()

void setHyperLinkDestination ( wchar_t *  href)

Sets the hyper-link destination of this Sprite.

If this Sprite is a hyper-link Sprite, i.e., its guiType property is set to GUI_HYPERLINK, then this function can be used to set it destination. The destination is a OGTemplate URLspecified by a C string.
 Note  If the Sprite is not hyper-link Sprite, this function does nothing.

Parameters
hrefA OGTemplate URL specified by a C string.
See also
GUI_SPRITE_TYPE
OGTemplate

§ getHyperLinkDestination()

wchar_t* getHyperLinkDestination ( )

Gets the hyper-link destination of this Sprite.

If this Sprite is a hyper-link Sprite, this function returns the hyper-link destination (A OGTemplate URL), otherwise it returns NULL.

Returns
the hyper-link destination (A OGTemplate URL) of this Sprite returned as a C string.
Null if this Sprite is not hyper-link Sprite.
See also
GUI_SPRITE_TYPE
OGTemplate

§ setSpriteEditBoxAttribute()

void setSpriteEditBoxAttribute ( wchar_t *  attribName,
int  attribValue 
)

Sets the edit-box attributes of this Sprite if it is an edit-box Sprite.

If this Sprite is an edit-box Sprite, this function sets one edit-box attributes specified by the attribute name. See the following attribute name/value chart.

Attribute Name Attribute Value Meaning
EDITBOX_ATTR_MULTI_LINE integer 1 (true) or 0 (false) Whether this is a multi-line edit-box
EDITBOX_ATTR_MAX_LENGTH integer Maximum number of characters can be input in this edit-box
EDITBOX_ATTR_INPUT_TYPE integer, must be one of constants defined in EDITBOX_INPUT_TYPES The input type of a edit-box Sprite, defined by EDITBOX_INPUT_TYPES
EDITBOX_ATTR_ALLOW_EMPTY integer 1 (true) or 0 (false) Whether this edit-box allows empty input (has 0 characters)
EDITBOX_ATTR_READ_ONLY; integer 1 (true) or 0 (false) Whether this edit-box is read-only
EDITBOX_ATTR_SHOW_AS_PASSWORD; integer 1 (true) or 0 (false) Whether this edit-box hides characters that user input (shown as "*")

 Note  If the Sprite is not edit-box Sprite, this function does nothing.

Parameters
attribNameThe attribute name specified by a C string
attribValueThe attribute value specified by an integer.
If the attribute has boolean value, then use number "1" to represent "true" and number "0" to represent "false".
See also
EDITBOX_INPUT_TYPES
getSpriteEditBoxAttribute

§ getSpriteEditBoxAttribute()

int getSpriteEditBoxAttribute ( wchar_t *  attribName)

Gets the edit-box attributes of this Sprite if it is an edit-box Sprite.

If this Sprite is an edit-box Sprite, this function gets one edit-box attributes specified by the attribute name. See function setSpriteEditBoxAttribute for the attribute name and value format. If this Sprite is not an edit-box Sprite, it returns NULL.

Parameters
attribNameThe attribute name specified by a C string
Returns
One attribute of this Sprite if it is an edit-box Sprite, NULL otherwise.
See also
setSpriteEditBoxAttribute

§ setNavigationIndex()

bool setNavigationIndex ( wchar_t  numericIndex,
wchar_t  alphabeticIndex,
wchar_t  specialIndex = 0 
)

Sets this Sprite's keyboard navigation index (shortcut).

When the Sprite's container SceneSprite has its keyboard navigation mode set to SceneSprite::NAVIGATION_INDEXENTRY, the keyboard navigation index set by this function can be used to "virtually click" the Sprite by the keyboard shortcut. See SceneSprite::KEYBOARD_NAVIGATION_MODE for details.

The navigation index can be specified by a special navigation index, one of constants defines by OGCanvas::SPECIAL_NAVIGATION_INDEX or by a two-character string which is a combination of one numeric index plus one alphabetic index.

 Note  Sprite's keyboard navigation index has not effect unless the container SceneSprite has its navigation mode set to SceneSprite::NAVIGATION_INDEXENTRY and the sprite is an interactive sprite .
 Note  When the attribute is specified by a combination of one numeric index and an alphabetic index, the first index is numeric shortcut and the second index is the alphabetic shortcut.

Parameters
numericIndexNumeric index (shortcut), one of numeric characters ['0', ..., '9']
alphabeticIndexAlphabetic index (shortcut), one of capital alphabet characters ['A', ..., 'Z']
specialIndexSpecial index (shortcut), one of constants defines by GUI::OGCanvas::SPECIAL_NAVIGATION_INDEX.
The default value of this argument is 0, indicates there is no special index for this Sprite.
Returns
True if it succeeds, False if it fails.
See also
getSpriteEditBoxAttribute
SceneSprite::KEYBOARD_NAVIGATION_MODE
SceneSprite::NAVIGATION_INDEXENTRY
GUI::OGCanvas::SPECIAL_NAVIGATION_INDEX
GUI_SPRITE_TYPE

§ setIndexTokenOffset()

void setIndexTokenOffset ( int  offsetX,
int  offsetY 
)

Sets the index token text offset.

 Note  The SceneSprite class has a function SceneSprite::setIndexTokenOffset(), which set the token text offset at the SceneSprite level; This function set per-sprite based token text offset and is applied after the per-scene based token text offset.

Parameters
offsetXThe index token X-offset, in pixels
offsetYThe index token Y-offset, in pixels
See also
getIndexTokenOffsetX
getIndexTokenOffsetY
SceneSprite::setIndexTokenOffset()

§ getIndexTokenOffsetX()

int getIndexTokenOffsetX ( )

Gets the index token text X-offset.

Returns
The index token text X-offset, in pixels.
See also
setIndexTokenOffset
SceneSprite::getIndexTokenOffsetX

§ getIndexTokenOffsetY()

int getIndexTokenOffsetY ( )

Gets the index token text Y-offset.

Returns
The index token text Y-offset, in pixels.
See also
setIndexTokenOffset
SceneSprite::getIndexTokenOffsetY

Member Data Documentation

§ EDITBOX_ATTR_MULTI_LINE

wchar_t* EDITBOX_ATTR_MULTI_LINE
static

A constant wide-char C string ("multiline") used to set or get multi-line attribute of a sprite-based edit-box.

See also
setSpriteEditBoxAttribute
getSpriteEditBoxAttribute

§ EDITBOX_ATTR_MAX_LENGTH

wchar_t* EDITBOX_ATTR_MAX_LENGTH
static

A constant wide-char C string ("maxLength") used to set or get max-length attribute of a sprite-based edit-box.

See also
setSpriteEditBoxAttribute
getSpriteEditBoxAttribute

§ EDITBOX_ATTR_INPUT_TYPE

wchar_t* EDITBOX_ATTR_INPUT_TYPE
static

A constant wide-char C string ("inputType") used to set or get input-type attribute of a sprite-based edit-box.

See also
setSpriteEditBoxAttribute
getSpriteEditBoxAttribute

§ EDITBOX_ATTR_ALLOW_EMPTY

wchar_t* EDITBOX_ATTR_ALLOW_EMPTY
static

A constant wide-char C string ("allowEmpty") used to set or get allow-empty attribute of a sprite-based edit-box.

See also
setSpriteEditBoxAttribute
getSpriteEditBoxAttribute

§ EDITBOX_ATTR_READ_ONLY

wchar_t* EDITBOX_ATTR_READ_ONLY
static

A constant wide-char C string ("readOnly") used to set or get read-only attribute of a sprite-based edit-box.

See also
setSpriteEditBoxAttribute
getSpriteEditBoxAttribute

§ EDITBOX_ATTR_SHOW_AS_PASSWORD

wchar_t* EDITBOX_ATTR_SHOW_AS_PASSWORD
static

A constant wide-char C string ("showAsPassword") used to set or get show-as-password attribute of a sprite-based edit-box.

See also
setSpriteEditBoxAttribute
getSpriteEditBoxAttribute

§ x

int x

The x coordinate (in pixels) of this Sprite's anchor point (left-top corner by default), defined in the containing SceneSprite coordinate system. The default value is set to 0.

See illustration

See also
anchorPoint

§ y

int y

The y coordinate (in pixels) of this Sprite's anchor point (left-top corner by default), defined in the containing SceneSprite coordinate system. The default value is set to 0.

See illustration

See also
anchorPoint

§ z

int z

The depth position of this Sprite, the default value is set to 0.

Sprite's depth value is not in use until SceneSprite::sortSpriteByZOrder is set to True. In that case, the depth value is the Z-order value used by RenderPipelineSprite to sort all sprites before render them. See SceneSprite::sortSpriteByZOrder for more details.

See also
SceneSprite::sortSpriteByZOrder

§ width

int width

The width in pixels of this Sprite, the default value is set to 0.

See illustration

§ height

int height

The height in pixels of this Sprite, default value is set to 0.

See illustration

§ color

int color

The background color of this Sprite.

The default value is CLEAR , means that the Sprite has clear (no) background.
 Tip  See Sprite Visual Anatomy
 Note  The "active" counterpart of this property is colorBright.

See also
colorBright
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ colorBright

int colorBright

The background color of this Sprite when it is under "active" state (The Sprite's state is STATE_ACTIVE ).

The default value is CLEAR , means that the Sprite has clear (no) background.
 Tip  See Sprite Visual Anatomy

See also
color
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ colorTransparency

int colorTransparency

The transparency level of the background color, in range of [0, 255] where 0 indicates full opacity and 255 indicates full transparency.

The default value is 0.
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

§ outlineColor

int outlineColor

The outline color of this Sprite.

The default value is CLEAR , means that the Sprite has no outline.
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

§ frameColor

int frameColor

The frame color of this Sprite.

The default value is CLEAR , means that the Sprite has no frame.
 Tip  See Sprite Visual Anatomy
 Note  The "active" counterpart of this property is frameColorBright.

See also
frameColorBright
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ frameColorBright

int frameColorBright

The frame color of this Sprite when it is under "active" state (The Sprite's state is STATE_ACTIVE ).

The default value is CLEAR , means that the Sprite has no frame.
 Tip  See Sprite Visual Anatomy

See also
frameColor
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ frameBevel

int frameBevel

The frame bevel style of this Sprite, must be one of constants defined in FRAME_BEVEL_TYPE .

The default value is GraphicsKernel::GraphicsEngine::BEVEL_NONE, means that the Sprite has no frame bevel.
 Tip  See Sprite Visual Anatomy  Note  The "active" counterpart of this property is frameBevelBright.

See also
frameBevelBright
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ frameBevelBright

int frameBevelBright

The frame bevel style of this Sprite when it is under "active" state (The Sprite's state is STATE_ACTIVE ), must be one of constants defined in FRAME_BEVEL_TYPE .

The default value is GraphicsKernel::GraphicsEngine::BEVEL_NONE, means that the Sprite has no frame bevel.
 Tip  See Sprite Visual Anatomy

See also
frameBevel
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ frameThickness

int frameThickness

The frame thickness of this Sprite, measured in pixels.

The default value is 1 point
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

See also
MiniAWT::Content::pointToPixel

§ frameAsUnderline

bool frameAsUnderline

Indicates whether the Sprite's frame should be rendered as underline (when True) or regular frame (when False).

The default value is False
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

§ cornerCut

int cornerCut

The corner-cut (chamfer) size of this Sprite, measured in pixels.

The default value is 0, means there is no corner-cut.
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

§ anchorPoint

int anchorPoint

The anchor point type of this Sprite, must be one of constants defined in POSITION_ANCHORPOINT_TYPE.

The anchor point determines the geometrical origin of a Sprite. The anchor type has effect on numbers of things when the sprite is rendered, see POSITION_ANCHORPOINT_TYPE for more details.

See also
POSITION_ANCHORPOINT_TYPE

§ textSize

int textSize

The text font size of this Sprite, measured in pixels.

The default value is 14 point
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

See also
MiniAWT::Content::pointToPixel

§ textBold

bool textBold

Whether the Sprite's text has bold style.

The default value is false
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

§ textItalic

bool textItalic

Whether the Sprite's text has italic style.

The default value is false
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

§ textUnderline

bool textUnderline

Whether the Sprite's text has underline style.

The default value is false
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

§ textColor

int textColor

The text color of this Sprite.

The default value is WHITE .
 Tip  See Sprite Visual Anatomy
 Note  The "active" counterpart of this property is textColorBright.

See also
textColorBright
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ textColorBright

int textColorBright

The text color of this Sprite when it is under "active" state (The Sprite's state is STATE_ACTIVE ).

The default value is WHITE .
 Tip  See Sprite Visual Anatomy

See also
textColor
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ textTransparency

int textTransparency

The transparency level of Sprite's text, in range of [0, 255] where 0 indicates full opacity and 255 indicates full transparency.

The default value is 0.
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

§ textShadow

int textShadow

The text shadow color of this Sprite.

The default value is CLEAR , means that the Sprite has no shadow.
 Tip  See Sprite Visual Anatomy
 Note  The "active" counterpart of this property is textShadowTransparency.

See also
textShadowTransparency
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ textShadowTransparency

int textShadowTransparency

The text shadow color of this Sprite when it is under "active" state (The Sprite's state is STATE_ACTIVE ).

The default value is CLEAR , means that the Sprite has no shadow.
 Tip  See Sprite Visual Anatomy

See also
textShadow
SceneGraph::Group::state
SceneGraph::Group::GROUP_STATE

§ textFormatted

bool textFormatted

Indicates whether the Sprite's text is formatted or not.

The default value is False. When the Sprite's text is not formatted, the text is rendered in a single text line, from left to right, without boundary checking and text aligning. When the Sprite's text is formatted, the text if rendered with format defined by textAlignment and textVAlignment.

 Tip  In case performance is critical, Sprite's textFormatted property should be set to False since rendering formatted text takes more processor power.
 Tip  See Sprite Visual Anatomy

See also
TEXT_ALIGNMENT_MODE
textAlignment
textVAlignment
textPadding
textLineSpacing

§ textAlignment

int textAlignment

The horizontal text alignment of this Sprite, must be one of constants defined in TEXT_ALIGNMENT_MODE.

The default value is ALIGN_LEFT.  Tip  See Sprite Visual Anatomy
 Note  This property has no effect unless the property textFormatted is set to True.

See also
textFormatted
TEXT_ALIGNMENT_MODE

§ textVAlignment

int textVAlignment

The vertical text alignment of this Sprite, must be one of constants defined in TEXT_V_ALIGNMENT_MODE.

The default value is ALIGN_V_TOP.  Tip  See Sprite Visual Anatomy
 Note  This property has no effect unless the property textFormatted is set to True.

See also
textFormatted
TEXT_V_ALIGNMENT_MODE

§ textPadding

int textPadding

The padding space between text and Sprite's boundary, in pixels.

The default value is 0.  Tip  See Sprite Visual Anatomy
 Note  This property has no effect unless the property textFormatted is set to True.

See also
textFormatted

§ textLineSpacing

int textLineSpacing

The line space of this Sprite, in pixels.

The default value is 0.  Tip  See Sprite Visual Anatomy
 Note  This property has no effect unless the property textFormatted is set to True.

See also
textFormatted

§ textOffsetX

int textOffsetX

The X-offset in pixels when the Sprite's text is rendered

The default value is 0.  Tip  See Sprite Visual Anatomy

See also
textOffsetY

§ textOffsetY

int textOffsetY

The Y-offset in pixels when the Sprite's text is rendered

The default value is 0.  Tip  See Sprite Visual Anatomy

See also
textOffsetX

§ useMonoFont

bool useMonoFont

Whether to use mono-spaced font when render the Sprite's text.

The default value is False, means use proportional font for Sprite's text.  Tip  See Sprite Visual Anatomy

See also
MiniAWT::Graphics::BitmapFont
MiniAWT::Application::setFont
MiniAWT::Application::getFont
MiniAWT::Application::getDefaultFont

§ bitmapFont

The BitmapFont of this Sprite.

By default this property is NULL, indicates the Sprite does not have BitmapFont and the text is rendered by regular application font. Depends on another property useMonoFont, the render pipeline will use Application's proportional font or mono-spaced font (both can be retrieved by function MiniAWT::Application::getFont()) to render the Sprite's text.

When this property is set to a reference of a BitmapFont , the render pipeline use this special font to render Sprite's text. Usually the bitmap font assigned to a Sprite are artistic font and has strong decoration effect, suitable for applications like games.

 Tip  See Sprite Visual Anatomy
 Note  The "active" counterpart of this property is bitmapFontBright.

See also
MiniAWT::Graphics::BitmapFont
MiniAWT::Application::setFont
MiniAWT::Application::getFont
MiniAWT::Application::getDefaultFont
useMonoFont
bitmapFontBright

§ bitmapFontBright

MiniAWT::Graphics::BitmapFont* bitmapFontBright

The BitmapFont of this Sprite when it is under "active" state (The Sprite's state is STATE_ACTIVE ). See bitmapFont for more details.

The default value is NULL, indicates the Sprite does not have BitmapFont.
 Tip  See Sprite Visual Anatomy

See also
MiniAWT::Graphics::BitmapFont
MiniAWT::Application::setFont
MiniAWT::Application::getFont
MiniAWT::Application::getDefaultFont
useMonoFont
bitmapFont

§ texture

Texture* texture

The Texture of this Sprite.

The Sprite's texture its graphical element rendered by a picture above the Sprite's background and underneath the Sprite's text. By default this property is NULL, indicates the Sprite does not have a texture.

When this property is set to a reference of a Texture , the render pipeline renders this texture right on top of its background. The most common use of Sprite's texture is to give it a pictorial presentation.

 Tip  See Sprite Visual Anatomy
 Note  The "active" counterpart of this property is textureBright.

See also
GraphicsApp::Texture
textureBright

§ textureBright

Texture* textureBright

The Texture of this Sprite when it is under "active" state (The Sprite's state is STATE_ACTIVE ). See texture for more details.  Tip  See Sprite Visual Anatomy

See also
GraphicsApp::Texture
texture

§ textureTransparency

int textureTransparency

The transparency level of the Sprite's texture, in range of [0, 255] where 0 indicates full opacity and 255 indicates full transparency.

The default value is 0.
 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

§ textureTiling

bool textureTiling

Indicates whether the Texture of this Sprite should be rendered as a single picture or repeated as numbers of picture tiles.

When this property is set to True, then the texture will be used as "picture tiles" to fill up the whole area of the Sprite's bounding box. The tile size can be controlled by property textureOutputW and textureOutputH. The default value is False, rendered as a single picture.

 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

See also
textureOutputW
textureOutputH

§ textureOutputW

int textureOutputW

The width of Sprite's texture output size, in pixels.

The default value is -1, indicates the output size is not specified, in this case render pipeline render the texture with the same size of the Sprite's bounding box.

 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

See also
textureOutputH
textureOffsetX
textureOffsetY

§ textureOutputH

int textureOutputH

The height of Sprite's texture output size, in pixels.

The default value is -1, indicates the output size is not specified, in this case render pipeline render the texture with the same size of the Sprite's bounding box.

 Tip  See Sprite Visual Anatomy
 Note  This property is used for both "normal" and "active" state.

See also
textureOutputW
textureOffsetX
textureOffsetY

§ textureOffsetX

int textureOffsetX

The horizontal offset when the Sprite's texture is rendered, in pixel.

The default value is 0.  Tip  See Sprite Visual Anatomy

See also
textureOffsetY

§ textureOffsetY

int textureOffsetY

The vertical offset when the Sprite's texture is rendered, in pixel.

The default value is 0.  Tip  See Sprite Visual Anatomy

See also
textureOffsetX

§ textureClipX

int textureClipX

The X coordinate of the left-top corner of texture's clipping window, defined in pixels in texture's Bitmap pixel space.

The properties textureClipX, textureClipY, textureClipW and textureClipH works together to define a clipping window of Sprite's texture. When the texture is rendered, only the portion in the clipping window is used. If any one of these four properties is set to -1, it indicates that there is no clipping window and the texture is rendered by its whole content. The default value is -1.
 Tip  See Sprite Visual Anatomy
 Note  The clipping window has dimension defined in texture's Bitmap pixel space.

See also
GraphicsApp::Texture
MiniAWT::Graphics::Bitmap

§ textureClipY

int textureClipY

The Y coordinate of the left-top corner of texture's clipping window, defined in pixels in texture's Bitmap pixel space.
See textureClipX for more details about texture clipping window. The default value is -1.
 Tip  See Sprite Visual Anatomy
 Note  The clipping window has dimension defined in texture's Bitmap pixel space.

See also
GraphicsApp::Texture
MiniAWT::Graphics::Bitmap

§ textureClipW

int textureClipW

The width of texture's clipping window, defined in pixels in texture's Bitmap pixel space.
See textureClipX for more details about texture clipping window. The default value is -1.
 Tip  See Sprite Visual Anatomy
 Note  The clipping window has dimension defined in texture's Bitmap pixel space.

See also
GraphicsApp::Texture
MiniAWT::Graphics::Bitmap

§ textureClipH

int textureClipH

The height of texture's clipping window, defined in pixels in texture's Bitmap pixel space.
See textureClipX for more details about texture clipping window.  Note  The clipping window has dimension defined in texture's Bitmap pixel space. The default value is -1.
 Tip  See Sprite Visual Anatomy
 Note  The clipping window has dimension defined in texture's Bitmap pixel space.

See also
GraphicsApp::Texture
MiniAWT::Graphics::Bitmap

§ textureAlignment

int textureAlignment

The property determines how Sprite's texture is aligned with Sprite when it is rendered. The value must be one of constants defined in POSITION_ANCHORPOINT_TYPE.

 Tip  See Sprite Visual Anatomy
The default value is ANCHOR_LEFT_TOP, which means the texture is aligned to the left-top corner of Sprite's bounding box.

See also
POSITION_ANCHORPOINT_TYPE

§ textureRotation

float textureRotation

The texture rotation angle, measured in degree and makes texture rotated counterclockwise.

The texture is rotated around the rotation anchor point, defined by textureRotationAnchorX and textureRotationAnchorY. textureRotationAnchorX and textureRotationAnchorY are two float numbers normalized by textureOutputW and textureOutputH, Following pseudo code shows the logic how render pipeline calculates the actual rotation pivot:

Sprite * spt = ...; //Get the Sprite instance
int pivotX = spt->textureOutputX + spt->textureOutputW * spt->textureRotationAnchorX;
int pivotY = spt->textureOutputY + spt->textureOutputH * spt->textureRotationAnchorY;
int rotationAngle = textureRotation * MathUtil::PI / 180.f; //Convert rotation angle into radian
... // Render the Sprite's texture at (textureOutputX, textureOutputY) and rotated around pivot (pivotX, pivotY)

The default value of both textureRotationAnchorX and textureRotationAnchorY are set to 0, means the texture are rotated (if textureRotation is not 0) around its center.  Tip  See Sprite Visual Anatomy

See also
textureRotationAnchorX
textureRotationAnchorY

§ textureRotationAnchorX

float textureRotationAnchorX

Defines the horizontal offset of Sprite's texture rotation anchor (pivot), a floating-point number normalized by textureOutputW where 1.0f is equal to Sprite's texture output width. See textureRotation for more details.
 Tip  See Sprite Visual Anatomy

See also
textureRotation
textureOutputW
textureOutputH

§ textureRotationAnchorY

float textureRotationAnchorY

Defines the vertical offset of Sprite's texture rotation anchor (pivot), a floating-point number normalized by textureOutputH where 1.0f is equal to Sprite's texture output height. See textureRotation for more details.
 Tip  See Sprite Visual Anatomy

See also
textureRotation
textureOutputW
textureOutputH

§ textureLeftEdgeInset

int textureLeftEdgeInset

One of four properties (textureLeftEdgeInset, textureRightEdgeInset, textureTopEdgeInset, textureBottomEdgeInset) who work together to define nine-patch sections of Sprite's texture so that the texture can be rendered in arbitrary aspect ratio without anamorphic effect.

 Note  The word "EdgeInset" is inspired by iOS imageEdgeInsets; the Android's equivalent technology is called NinePatch.

The value is defined in texture's Bitmap pixel space.
The default value of all of four properties are set to 0, means there is no edge insets applied.  Tip  See Sprite Visual Anatomy

See also
GraphicsApp::Texture
MiniAWT::Graphics::Bitmap
textureRightEdgeInset
textureTopEdgeInset
textureBottomEdgeInset

§ textureRightEdgeInset

int textureRightEdgeInset

One of four properties (textureLeftEdgeInset, textureRightEdgeInset, textureTopEdgeInset, textureBottomEdgeInset) who work together to define nine-patch sections of Sprite's texture so that the texture can be rendered in arbitrary aspect ratio without anamorphic effect.

See textureLeftEdgeInset for more details.  Tip  See Sprite Visual Anatomy

See also
GraphicsApp::Texture
MiniAWT::Graphics::Bitmap
textureLeftEdgeInset
textureTopEdgeInset
textureBottomEdgeInset

§ textureTopEdgeInset

int textureTopEdgeInset

One of four properties (textureLeftEdgeInset, textureRightEdgeInset, textureTopEdgeInset, textureBottomEdgeInset) who work together to define nine-patch sections of Sprite's texture so that the texture can be rendered in arbitrary aspect ratio without anamorphic effect.

See textureLeftEdgeInset for more details.  Tip  See Sprite Visual Anatomy

See also
GraphicsApp::Texture
MiniAWT::Graphics::Bitmap
textureLeftEdgeInset
textureRightEdgeInset
textureBottomEdgeInset

§ textureBottomEdgeInset

int textureBottomEdgeInset

One of four properties (textureLeftEdgeInset, textureRightEdgeInset, textureTopEdgeInset, textureBottomEdgeInset) who work together to define nine-patch sections of Sprite's texture so that the texture can be rendered in arbitrary aspect ratio without anamorphic effect.

See textureLeftEdgeInset for more details.  Tip  See Sprite Visual Anatomy

See also
GraphicsApp::Texture
MiniAWT::Graphics::Bitmap
textureLeftEdgeInset
textureRightEdgeInset
textureTopEdgeInset

§ guiType

int guiType

Sets or gets the GUI (graphical user interface) type of this Sprite, must be one of constants defined in GUI_SPRITE_TYPE.

Sprite's GUI type tells the role of a Sprite in user interface, see GUI_SPRITE_TYPE for more details. See Static Sprite vs Interactive Sprite for more details.

See also
GUI_SPRITE_TYPE

§ tabStop

bool tabStop

Sets or gets whether this Sprite is a candidate for keyboard navigation (tab navigation mode).

When set to True, this Sprite can be reached by the keyboard navigation (tab navigation mode). The default value is True. When set to False, the navigation (tab navigation mode) focus will jump over this sprite and move to the next candidate.

See also
SceneSprite:KEYBOARD_NAVIGATION_MODE
SceneSprite:TAB_NAVIGATION_METHOD

§ enabled

bool enabled

Sets or gets whether this Sprite is enabled or disabled.

This property is only in use when the Sprite is an interactive sprite (see GUI_SPRITE_TYPE). The default value is True.

See also
guiType
GUI_SPRITE_TYPE
SceneSprite::DisabledLookListener
SceneSprite::disabledLookListener

§ pickingExtensionX

int pickingExtensionX

Sets or gets the horizontal picking extension of a interactive sprite (see GUI_SPRITE_TYPE), in pixels.

This property is used to enlarge (when value is positive) the "hot zone" of an interactive sprite to make picking it easier. The default value is 0 pixel.  Tip  See Sprite Visual Anatomy

See also
guiType
GUI_SPRITE_TYPE
pickingExtensionY

§ pickingExtensionY

int pickingExtensionY

Sets or gets the horizontal picking extension of a interactive sprite (see GUI_SPRITE_TYPE), in pixels.

This property is used to enlarge (when value is positive) the "hot zone" of an interactive sprite to make picking it easier. The default value is 0 pixel.  Tip  See Sprite Visual Anatomy

See also
guiType
GUI_SPRITE_TYPE
pickingExtensionX

§ draggable

bool draggable

Sets or gets whether this Sprite is draggable, i.e., dragged by pointing device (mouse, touch, etc.).

See also
DraggingListener
draggingListener

§ repeatMouseClicking

bool repeatMouseClicking

Sets or gets whether this (interactive) Sprite is able to repeatedly generates clicking events when it is pressed by a pointing device (mouse, touch).

The default value is False, it means when this (interactive) Sprite is pressed by pointing device, it generates only one event MOUSE_STATUS_DOWN , and when it is released by pointing device, it generates another event MOUSE_STATUS_UP .

When this property is set to True, when this (interactive) Sprite is pressed by pointing device, it repeatedly generates event MOUSE_STATUS_DOWN and MOUSE_STATUS_UP until it is released by pointing device. As the result, the events generated between pointing device's press and release actions are in the following pattern:

mouse down, mouse up, mouse down, mouse up, mouse down, ..., mouse up, mouse down, mouse up

The event simulation generates the effect that user repeatedly click this Sprite.

The following properties are used to do fine tune up on the simulated mouse clicking repeat:

See also
clickingRepeatInterval
clickingRepeatFirstTimeInterval
MiniAWT::Window::POINTING_DEVICE_STATE
guiType
GUI_SPRITE_TYPE

§ clickingRepeatInterval

int clickingRepeatInterval

The time interval in milliseconds that works together with repeatMouseClicking to control how fast the clicking events are repeated. See repeatMouseClicking for more details.

See also
repeatMouseClicking
clickingRepeatFirstTimeInterval

§ clickingRepeatFirstTimeInterval

int clickingRepeatFirstTimeInterval

The time interval in milliseconds that works together with repeatMouseClicking to determine how much delay applied before the first clicking events repeat. See repeatMouseClicking for more details.

See also
repeatMouseClicking
clickingRepeatInterval

§ persistent

bool persistent

Sets or gets whether the value maintained by this (interactive) Sprite will be persistent across application sessions.

Certain types of interactive Sprite can maintain a value (see Sprites Maintains a Value). When this property is set to True, the value maintained by this Sprite will be automatically saved in Application's local storage when the OGCanvas who contains this Sprite unload its content (see GUI::OGCanvas::unloadTemplate). The value will be automatically recovered next time when OGCanvas load the same content (see GUI::OGCanvas::loadTemplate()). See OGCanvas for more details. This behavior generates an effect that this (interactive) Sprite is able to automatically persist the value it maintains.

OGTemplate has a special attribute persistent which indicate the value of the target Sprite and LWComponent should be persistent across multiple application sessions. For example, the value of edit-box (Sprite) that contains user name and e-mail, or the user selection of a drop-down box (LWComboBox) that contains the country/area might need to be persistent across application sessions for convenience purpose. This can be done easily by applying persistent attribute and set it to true.

sptName = type:Sprite, container:sceneGUI, text:Name, ..., persistent:TRUE //The Sprite for name
sptEMail = type:Sprite, container:sceneGUI, text:E-mail, ..., persistent:TRUE //The Sprite for e-mail
compCountry = type:Sprite, container:sceneGUI, GUIType:LWCOMPONENT, \ //The LWComboBox for country/area selection
className:LWComboBox(...), ..., persistent:TRUE

During the application sessions, when user input text for user name and e-mail, or select the country from the drop-down list, the value will be persisted and during the next application sessions, the updated persisted value will be presented.

See OGTemplate reference for more details.

The default value is False.

See also
GUI::OGCanvas
GUI::OGCanvas::loadTemplate
GUI::OGCanvas::unloadTemplate

§ renderListener

RenderListener* renderListener

Sets or gets the RenderListener of this Sprite, see RenderListener for more tails.

The default value is NULL, means the listener is not registered.

See also
RenderListener

§ draggingListener

DraggingListener* draggingListener

Sets or gets the DraggingListener of this Sprite, see DraggingListener for more tails.

The default value is NULL, means the listener is not registered.

See also
DraggingListener

§ editBoxVerificationListener

EditBoxVerificationListener* editBoxVerificationListener

Sets or gets the EditBoxVerificationListener of this Sprite, see EditBoxVerificationListener for more tails.

The default value is NULL, means the listener is not registered.

See also
EditBoxVerificationListener