UI element which allows sub-pixel positioning and size, as well as rotation. Only other Sprites should be added as child elements. More...

#include <Sprite.h>

Inheritance diagram for Urho3D::Sprite:
[legend]
Collaboration diagram for Urho3D::Sprite:
[legend]

Public Member Functions

 Sprite (Context *context)
 Construct.
 
virtual ~Sprite ()
 Destruct.
 
virtual bool IsWithinScissor (const IntRect &currentScissor)
 Return whether is visible and inside a scissor rectangle and should be rendered. More...
 
virtual const IntVector2GetScreenPosition () const
 Update and return screen position.
 
virtual void GetBatches (PODVector< UIBatch > &batches, PODVector< float > &vertexData, const IntRect &currentScissor)
 Return UI rendering batches.
 
virtual void OnPositionSet ()
 React to position change.
 
void SetPosition (const Vector2 &position)
 Set floating point position.
 
void SetPosition (float x, float y)
 Set floating point position.
 
void SetHotSpot (const IntVector2 &hotSpot)
 Set hotspot for positioning and rotation.
 
void SetHotSpot (int x, int y)
 Set hotspot for positioning and rotation.
 
void SetScale (const Vector2 &scale)
 Set scale. Scale also affects child sprites.
 
void SetScale (float x, float y)
 Set scale. Scale also affects child sprites.
 
void SetScale (float scale)
 Set uniform scale. Scale also affects child sprites.
 
void SetRotation (float angle)
 Set rotation angle.
 
void SetTexture (Texture *texture)
 Set texture.
 
void SetImageRect (const IntRect &rect)
 Set part of texture to use as the image.
 
void SetFullImageRect ()
 Use whole texture as the image.
 
void SetBlendMode (BlendMode mode)
 Set blend mode.
 
const Vector2GetPosition () const
 Return floating point position.
 
const IntVector2GetHotSpot () const
 Return hotspot.
 
const Vector2GetScale () const
 Return scale.
 
float GetRotation () const
 Return rotation angle.
 
TextureGetTexture () const
 Return texture.
 
const IntRectGetImageRect () const
 Return image rectangle.
 
BlendMode GetBlendMode () const
 Return blend mode.
 
void SetTextureAttr (const ResourceRef &value)
 Set texture attribute.
 
ResourceRef GetTextureAttr () const
 Return texture attribute.
 
const Matrix3x4GetTransform () const
 Update and return rendering transform, also used to transform child sprites.
 
- Public Member Functions inherited from Urho3D::UIElement
 UIElement (Context *context)
 Construct.
 
virtual ~UIElement ()
 Destruct.
 
virtual void ApplyAttributes ()
 Apply attribute changes that can not be applied immediately.
 
virtual bool LoadXML (const XMLElement &source, bool setInstanceDefault=false)
 Load from XML data. Return true if successful.
 
virtual bool LoadXML (const XMLElement &source, XMLFile *styleFile, bool setInstanceDefault=false)
 Load from XML data with style. Return true if successful.
 
virtual bool LoadChildXML (const XMLElement &childElem, XMLFile *styleFile=0, bool setInstanceDefault=false)
 Create a child by loading from XML data with style. Return true if successful.
 
virtual bool SaveXML (XMLElement &dest) const
 Save as XML data. Return true if successful.
 
virtual void Update (float timeStep)
 Perform UI element update.
 
virtual void GetDebugDrawBatches (PODVector< UIBatch > &batches, PODVector< float > &vertexData, const IntRect &currentScissor)
 Return UI rendering batches for debug draw.
 
virtual void OnHover (const IntVector2 &position, const IntVector2 &screenPosition, int buttons, int qualifiers, Cursor *cursor)
 React to mouse hover.
 
virtual void OnClickBegin (const IntVector2 &position, const IntVector2 &screenPosition, int button, int buttons, int qualifiers, Cursor *cursor)
 React to mouse click begin.
 
virtual void OnClickEnd (const IntVector2 &position, const IntVector2 &screenPosition, int button, int buttons, int qualifiers, Cursor *cursor, UIElement *beginElement)
 React to mouse click end.
 
virtual void OnDoubleClick (const IntVector2 &position, const IntVector2 &screenPosition, int button, int buttons, int qualifiers, Cursor *cursor)
 React to double mouse click.
 
virtual void OnDragBegin (const IntVector2 &position, const IntVector2 &screenPosition, int buttons, int qualifiers, Cursor *cursor)
 React to mouse drag begin.
 
virtual void OnDragMove (const IntVector2 &position, const IntVector2 &screenPosition, const IntVector2 &deltaPos, int buttons, int qualifiers, Cursor *cursor)
 React to mouse drag motion.
 
virtual void OnDragEnd (const IntVector2 &position, const IntVector2 &screenPosition, int dragButtons, int releaseButton, Cursor *cursor)
 React to mouse drag end.
 
virtual void OnDragCancel (const IntVector2 &position, const IntVector2 &screenPosition, int dragButtons, int cancelButton, Cursor *cursor)
 React to a mouse drag cancel event (ie, when an extra button is pressed)
 
virtual bool OnDragDropTest (UIElement *source)
 React to drag and drop test. Return true to signal that the drop is acceptable.
 
virtual bool OnDragDropFinish (UIElement *source)
 React to drag and drop finish. Return true to signal that the drop was accepted.
 
virtual void OnWheel (int delta, int buttons, int qualifiers)
 React to mouse wheel.
 
virtual void OnKey (int key, int buttons, int qualifiers)
 React to a key press.
 
virtual void OnTextInput (const String &text, int buttons, int qualifiers)
 React to text input event.
 
virtual void OnResize ()
 React to resize.
 
virtual void OnSetEditable ()
 React to editable status change.
 
virtual void OnIndentSet ()
 React to indent change.
 
bool LoadXML (Deserializer &source)
 Load from an XML file. Return true if successful.
 
bool SaveXML (Serializer &dest, const String &indentation="\t") const
 Save to an XML file. Return true if successful.
 
bool FilterAttributes (XMLElement &dest) const
 Filter attributes in serialization process.
 
void SetName (const String &name)
 Set name.
 
void SetPosition (const IntVector2 &position)
 Set position.
 
void SetPosition (int x, int y)
 Set position.
 
void SetSize (const IntVector2 &size)
 Set size.
 
void SetSize (int width, int height)
 Set size.
 
void SetWidth (int width)
 Set width only.
 
void SetHeight (int height)
 Set height only.
 
void SetMinSize (const IntVector2 &minSize)
 Set minimum size.
 
void SetMinSize (int width, int height)
 Set minimum size.
 
void SetMinWidth (int width)
 Set minimum width.
 
void SetMinHeight (int height)
 Set minimum height.
 
void SetMaxSize (const IntVector2 &maxSize)
 Set maximum size.
 
void SetMaxSize (int width, int height)
 Set maximum size.
 
void SetMaxWidth (int width)
 Set maximum width.
 
void SetMaxHeight (int height)
 Set maximum height.
 
void SetFixedSize (const IntVector2 &size)
 Set fixed size.
 
void SetFixedSize (int width, int height)
 Set fixed size.
 
void SetFixedWidth (int width)
 Set fixed width.
 
void SetFixedHeight (int height)
 Set fixed height.
 
void SetAlignment (HorizontalAlignment hAlign, VerticalAlignment vAlign)
 Set horizontal and vertical alignment.
 
void SetHorizontalAlignment (HorizontalAlignment align)
 Set horizontal alignment.
 
void SetVerticalAlignment (VerticalAlignment align)
 Set vertical alignment.
 
void SetClipBorder (const IntRect &rect)
 Set child element clipping border.
 
void SetColor (const Color &color)
 Set color on all corners.
 
void SetColor (Corner corner, const Color &color)
 Set color on one corner.
 
void SetPriority (int priority)
 Set priority.
 
void SetOpacity (float opacity)
 Set opacity.
 
void SetBringToFront (bool enable)
 Set whether should be brought to front when focused.
 
void SetBringToBack (bool enable)
 Set whether should be put to background when another element is focused.
 
void SetClipChildren (bool enable)
 Set whether should clip child elements. Default false.
 
void SetSortChildren (bool enable)
 Set whether should sort child elements according to priority. Default true.
 
void SetUseDerivedOpacity (bool enable)
 Set whether parent elements' opacity affects opacity. Default true.
 
void SetEnabled (bool enable)
 Set whether reacts to input. Default false, but is enabled by subclasses if applicable.
 
void SetDeepEnabled (bool enable)
 Set enabled state on self and child elements. Elements' own enabled state is remembered (IsEnabledSelf) and can be restored.
 
void ResetDeepEnabled ()
 Reset enabled state to the element's remembered state prior to calling SetDeepEnabled.
 
void SetEnabledRecursive (bool enable)
 Set enabled state on self and child elements. Unlike SetDeepEnabled this does not remember the elements' own enabled state, but overwrites it.
 
void SetEditable (bool enable)
 Set whether value is editable through input. Not applicable to all elements. Default true.
 
void SetFocus (bool enable)
 Set whether is focused. Only one element can be focused at a time.
 
void SetSelected (bool enable)
 Set selected mode. Actual meaning is element dependent, for example constant hover or pressed effect.
 
void SetVisible (bool enable)
 Set whether is visible.
 
void SetFocusMode (FocusMode mode)
 Set focus mode.
 
void SetDragDropMode (unsigned mode)
 Set drag and drop flags.
 
bool SetStyle (const String &styleName, XMLFile *file=0)
 Set style from an XML file. Find the style element by name. If the style file is not explicitly provided, use the default style from parental chain. Return true if the style is applied successfully.
 
bool SetStyle (const XMLElement &element)
 Set style from an XML element. Return true if the style is applied successfully.
 
bool SetStyleAuto (XMLFile *file=0)
 Set style from an XML file. Find the style element automatically. If the style file is not explicitly provided, use the default style from parental chain. Return true if the style is applied successfully.
 
void SetDefaultStyle (XMLFile *style)
 Set default style file for later use by children elements.
 
void SetLayout (LayoutMode mode, int spacing=0, const IntRect &border=IntRect::ZERO)
 Set layout.
 
void SetLayoutMode (LayoutMode mode)
 Set layout mode only.
 
void SetLayoutSpacing (int spacing)
 Set layout spacing.
 
void SetLayoutBorder (const IntRect &border)
 Set layout border.
 
void SetLayoutFlexScale (const Vector2 &scale)
 Set layout flex scale.
 
void SetIndent (int indent)
 Set horizontal indentation.
 
void SetIndentSpacing (int indentSpacing)
 Set indent spacing (number of pixels per indentation level).
 
void UpdateLayout ()
 Manually update layout. Should not be necessary in most cases, but is provided for completeness.
 
void DisableLayoutUpdate ()
 Disable automatic layout update. Should only be used if there are performance problems.
 
void EnableLayoutUpdate ()
 Enable automatic layout update.
 
void BringToFront ()
 Bring UI element to front.
 
UIElementCreateChild (StringHash type, const String &name=String::EMPTY, unsigned index=M_MAX_UNSIGNED)
 Create and add a child element and return it.
 
void AddChild (UIElement *element)
 Add a child element.
 
void InsertChild (unsigned index, UIElement *element)
 Insert a child element into a specific position in the child list.
 
void RemoveChild (UIElement *element, unsigned index=0)
 Remove a child element. Starting search at specified index if provided.
 
void RemoveChildAtIndex (unsigned index)
 Remove a child element at index.
 
void RemoveAllChildren ()
 Remove all child elements.
 
void Remove ()
 Remove from the parent element. If no other shared pointer references exist, causes immediate deletion.
 
unsigned FindChild (UIElement *element) const
 Find child index. Return M_MAX_UNSIGNED if not found.
 
void SetParent (UIElement *parent, unsigned index=M_MAX_UNSIGNED)
 Set parent element. Same as parent->InsertChild(index, this).
 
void SetVar (StringHash key, const Variant &value)
 Set a user variable.
 
void SetInternal (bool enable)
 Mark as internally (programmatically) created. Used when an element composes itself out of child elements.
 
void SetTraversalMode (TraversalMode traversalMode)
 Set traversal mode for rendering. The default traversal mode is TM_BREADTH_FIRST for non-root element. Root element should be set to TM_DEPTH_FIRST to avoid artifacts during rendering.
 
void SetElementEventSender (bool flag)
 Set element event sender flag. When child element is added or deleted, the event would be sent using UIElement found in the parental chain having this flag set. If not set, the event is sent using UI's root as per normal.
 
template<class T >
T * CreateChild (const String &name=String::EMPTY, unsigned index=M_MAX_UNSIGNED)
 Template version of creating a child element.
 
const StringGetName () const
 Return name.
 
const IntVector2GetPosition () const
 Return position.
 
const IntVector2GetSize () const
 Return size.
 
int GetWidth () const
 Return width.
 
int GetHeight () const
 Return height.
 
const IntVector2GetMinSize () const
 Return minimum size.
 
int GetMinWidth () const
 Return minimum width.
 
int GetMinHeight () const
 Return minimum height.
 
const IntVector2GetMaxSize () const
 Return maximum size.
 
int GetMaxWidth () const
 Return minimum width.
 
int GetMaxHeight () const
 Return minimum height.
 
bool IsFixedSize () const
 Return true if size is fixed.
 
bool IsFixedWidth () const
 Return true if width is fixed.
 
bool IsFixedHeight () const
 Return true if height is fixed.
 
const IntVector2GetChildOffset () const
 Return child element offset.
 
HorizontalAlignment GetHorizontalAlignment () const
 Return horizontal alignment.
 
VerticalAlignment GetVerticalAlignment () const
 Return vertical alignment.
 
const IntRectGetClipBorder () const
 Return child element clipping border.
 
const ColorGetColor (Corner corner) const
 Return corner color.
 
int GetPriority () const
 Return priority.
 
float GetOpacity () const
 Return opacity.
 
float GetDerivedOpacity () const
 Return derived opacity (affected by parent elements.) If UseDerivedOpacity is false, returns same as element's own opacity.
 
bool GetBringToFront () const
 Return whether should be brought to front when focused.
 
bool GetBringToBack () const
 Return whether should be put to background when another element is focused.
 
bool GetClipChildren () const
 Return whether should clip child elements.
 
bool GetSortChildren () const
 Return whether should sort child elements according to priority.
 
bool GetUseDerivedOpacity () const
 Return whether parent elements' opacity affects opacity.
 
bool HasFocus () const
 Return whether has focus.
 
bool IsEnabled () const
 Return whether reacts to input.
 
bool IsEnabledSelf () const
 Returns the element's last own enabled state. May be different than the value returned by IsEnabled when SetDeepEnabled has been used.
 
bool IsEditable () const
 Return whether value is editable through input.
 
bool IsSelected () const
 Return whether is selected. Actual meaning is element dependent.
 
bool IsVisible () const
 Return whether is visible.
 
bool IsHovering () const
 Return whether the cursor is hovering on this element.
 
bool IsInternal () const
 Return whether is internally created.
 
bool HasColorGradient () const
 Return whether has different color in at least one corner.
 
FocusMode GetFocusMode () const
 Return focus mode.
 
unsigned GetDragDropMode () const
 Return drag and drop flags.
 
const StringGetAppliedStyle () const
 Return applied style name. Return an empty string when the applied style is an 'auto' style (i.e. style derived from instance's type).
 
XMLFileGetDefaultStyle (bool recursiveUp=true) const
 Return default style.
 
LayoutMode GetLayoutMode () const
 Return layout mode.
 
int GetLayoutSpacing () const
 Return layout spacing.
 
const IntRectGetLayoutBorder () const
 Return layout border.
 
const Vector2GetLayoutFlexScale () const
 Return layout flex scale.
 
unsigned GetNumChildren (bool recursive=false) const
 Return number of child elements.
 
UIElementGetChild (unsigned index) const
 Return child element by index.
 
UIElementGetChild (const String &name, bool recursive=false) const
 Return child element by name.
 
UIElementGetChild (const StringHash &key, const Variant &value=Variant::EMPTY, bool recursive=false) const
 Return child element by variable. If only key is provided, return the first child having the matching variable key. If value is also provided then the actual variable value would also be checked against.
 
const Vector< SharedPtr
< UIElement > > & 
GetChildren () const
 Return immediate child elements.
 
void GetChildren (PODVector< UIElement * > &dest, bool recursive=false) const
 Return child elements either recursively or non-recursively.
 
UIElementGetParent () const
 Return parent element.
 
UIElementGetRoot () const
 Return root element.
 
const ColorGetDerivedColor () const
 Return derived color. Only valid when no gradient.
 
const VariantGetVar (const StringHash &key) const
 Return a user variable.
 
const VariantMapGetVars () const
 Return all user variables.
 
int GetDragButtonCombo () const
 Return the drag button combo if this element is being dragged.
 
unsigned GetDragButtonCount () const
 Return the number of buttons dragging this element.
 
IntVector2 ScreenToElement (const IntVector2 &screenPosition)
 Convert screen coordinates to element coordinates.
 
IntVector2 ElementToScreen (const IntVector2 &position)
 Convert element coordinates to screen coordinates.
 
bool IsInside (IntVector2 position, bool isScreen)
 Return whether a point (either in element or screen coordinates) is inside the element.
 
bool IsInsideCombined (IntVector2 position, bool isScreen)
 Return whether a point (either in element or screen coordinates) is inside the combined rect of the element and its children.
 
IntRect GetCombinedScreenRect ()
 Return combined screen coordinate rect of element and its children.
 
void SortChildren ()
 Sort child elements if sorting enabled and order dirty. Called by UI.
 
int GetLayoutMinSize () const
 Return minimum layout element size in the layout direction. Only valid after layout has been calculated. Used internally by UI for optimizations.
 
int GetLayoutMaxSize () const
 Return maximum layout element size in the layout direction. Only valid after layout has been calculated. Used internally by UI for optimizations.
 
int GetIndent () const
 Return horizontal indentation.
 
int GetIndentSpacing () const
 Return indent spacing (number of pixels per indentation level).
 
int GetIndentWidth () const
 Return indent width in pixels.
 
void SetChildOffset (const IntVector2 &offset)
 Set child offset.
 
void SetHovering (bool enable)
 Set hovering state.
 
void AdjustScissor (IntRect &currentScissor)
 Adjust scissor for rendering.
 
void GetBatchesWithOffset (IntVector2 &offset, PODVector< UIBatch > &batches, PODVector< float > &vertexData, IntRect currentScissor)
 Get UI rendering batches with a specified offset. Also recurses to child elements.
 
const ColorGetColorAttr () const
 Return color attribute. Uses just the top-left color.
 
TraversalMode GetTraversalMode () const
 Return traversal mode for rendering.
 
bool IsElementEventSender () const
 Return whether element should send child added / removed events by itself. If false, defers to parent element.
 
UIElementGetElementEventSender () const
 Get element which should send child added / removed events.
 
- Public Member Functions inherited from Urho3D::Animatable
 Animatable (Context *context)
 Construct.
 
virtual ~Animatable ()
 Destruct.
 
void SetAnimationEnabled (bool enable)
 Set animation enabled.
 
void SetObjectAnimation (ObjectAnimation *objectAnimation)
 Set object animation.
 
void SetAttributeAnimation (const String &name, ValueAnimation *attributeAnimation, WrapMode wrapMode=WM_LOOP, float speed=1.0f)
 Set attribute animation.
 
void SetAttributeAnimationWrapMode (const String &name, WrapMode wrapMode)
 Set attribute animation wrap mode.
 
void SetAttributeAnimationSpeed (const String &name, float speed)
 Set attribute animation speed.
 
bool GetAnimationEnabled () const
 Return animation enabled.
 
ObjectAnimationGetObjectAnimation () const
 Return object animation.
 
ValueAnimationGetAttributeAnimation (const String &name) const
 Return attribute animation.
 
WrapMode GetAttributeAnimationWrapMode (const String &name) const
 Return attribute animation wrap mode.
 
float GetAttributeAnimationSpeed (const String &name) const
 Return attribute animation speed.
 
void SetObjectAnimationAttr (const ResourceRef &value)
 Set object animation attribute.
 
ResourceRef GetObjectAnimationAttr () const
 Return object animation attribute.
 
- Public Member Functions inherited from Urho3D::Serializable
 Serializable (Context *context)
 Construct.
 
virtual ~Serializable ()
 Destruct.
 
virtual void OnSetAttribute (const AttributeInfo &attr, const Variant &src)
 Handle attribute write access. Default implementation writes to the variable at offset, or invokes the set accessor.
 
virtual void OnGetAttribute (const AttributeInfo &attr, Variant &dest) const
 Handle attribute read access. Default implementation reads the variable at offset, or invokes the get accessor.
 
virtual const Vector
< AttributeInfo > * 
GetAttributes () const
 Return attribute descriptions, or null if none defined.
 
virtual const Vector
< AttributeInfo > * 
GetNetworkAttributes () const
 Return network replication attribute descriptions, or null if none defined.
 
virtual bool Load (Deserializer &source, bool setInstanceDefault=false)
 Load from binary data. When setInstanceDefault is set to true, after setting the attribute value, store the value as instance's default value. Return true if successful.
 
virtual bool Save (Serializer &dest) const
 Save as binary data. Return true if successful.
 
virtual bool SaveDefaultAttributes () const
 Return whether should save default-valued attributes into XML. Default false.
 
virtual void MarkNetworkUpdate ()
 Mark for attribute check on the next network update.
 
bool SetAttribute (unsigned index, const Variant &value)
 Set attribute by index. Return true if successfully set.
 
bool SetAttribute (const String &name, const Variant &value)
 Set attribute by name. Return true if successfully set.
 
void ResetToDefault ()
 Reset all editable attributes to their default values.
 
void RemoveInstanceDefault ()
 Remove instance's default values if they are set previously.
 
void SetTemporary (bool enable)
 Set temporary flag. Temporary objects will not be saved.
 
void SetInterceptNetworkUpdate (const String &attributeName, bool enable)
 Enable interception of an attribute from network updates. Intercepted attributes are sent as events instead of applying directly. This can be used to implement client side prediction.
 
void AllocateNetworkState ()
 Allocate network attribute state.
 
void WriteInitialDeltaUpdate (Serializer &dest, unsigned char timeStamp)
 Write initial delta network update.
 
void WriteDeltaUpdate (Serializer &dest, const DirtyBits &attributeBits, unsigned char timeStamp)
 Write a delta network update according to dirty attribute bits.
 
void WriteLatestDataUpdate (Serializer &dest, unsigned char timeStamp)
 Write a latest data network update.
 
bool ReadDeltaUpdate (Deserializer &source)
 Read and apply a network delta update. Return true if attributes were changed.
 
bool ReadLatestDataUpdate (Deserializer &source)
 Read and apply a network latest data update. Return true if attributes were changed.
 
Variant GetAttribute (unsigned index) const
 Return attribute value by index. Return empty if illegal index.
 
Variant GetAttribute (const String &name) const
 Return attribute value by name. Return empty if not found.
 
Variant GetAttributeDefault (unsigned index) const
 Return attribute default value by index. Return empty if illegal index.
 
Variant GetAttributeDefault (const String &name) const
 Return attribute default value by name. Return empty if not found.
 
unsigned GetNumAttributes () const
 Return number of attributes.
 
unsigned GetNumNetworkAttributes () const
 Return number of network replication attributes.
 
bool IsTemporary () const
 Return whether is temporary.
 
bool GetInterceptNetworkUpdate (const String &attributeName) const
 Return whether an attribute's network updates are being intercepted.
 
NetworkStateGetNetworkState () const
 Return the network attribute state, if allocated.
 
- Public Member Functions inherited from Urho3D::Object
 Object (Context *context)
 Construct.
 
virtual ~Object ()
 Destruct. Clean up self from event sender & receiver structures.
 
virtual Urho3D::StringHash GetType () const =0
 Return type hash.
 
virtual Urho3D::StringHash GetBaseType () const =0
 Return base class type hash.
 
virtual const Urho3D::StringGetTypeName () const =0
 Return type name.
 
virtual void OnEvent (Object *sender, StringHash eventType, VariantMap &eventData)
 Handle event.
 
void SubscribeToEvent (StringHash eventType, EventHandler *handler)
 Subscribe to an event that can be sent by any sender.
 
void SubscribeToEvent (Object *sender, StringHash eventType, EventHandler *handler)
 Subscribe to a specific sender's event.
 
void UnsubscribeFromEvent (StringHash eventType)
 Unsubscribe from an event.
 
void UnsubscribeFromEvent (Object *sender, StringHash eventType)
 Unsubscribe from a specific sender's event.
 
void UnsubscribeFromEvents (Object *sender)
 Unsubscribe from a specific sender's events.
 
void UnsubscribeFromAllEvents ()
 Unsubscribe from all events.
 
void UnsubscribeFromAllEventsExcept (const PODVector< StringHash > &exceptions, bool onlyUserData)
 Unsubscribe from all events except those listed, and optionally only those with userdata (script registered events.)
 
void SendEvent (StringHash eventType)
 Send event to all subscribers.
 
void SendEvent (StringHash eventType, VariantMap &eventData)
 Send event with parameters to all subscribers. More...
 
VariantMapGetEventDataMap () const
 Return a preallocated map for event data. Used for optimization to avoid constant re-allocation of event data maps.
 
ContextGetContext () const
 Return execution context.
 
ObjectGetSubsystem (StringHash type) const
 Return subsystem by type.
 
ObjectGetEventSender () const
 Return active event sender. Null outside event handling.
 
EventHandlerGetEventHandler () const
 Return active event handler. Null outside event handling.
 
bool HasSubscribedToEvent (StringHash eventType) const
 Return whether has subscribed to an event without specific sender.
 
bool HasSubscribedToEvent (Object *sender, StringHash eventType) const
 Return whether has subscribed to a specific sender's event.
 
bool HasEventHandlers () const
 Return whether has subscribed to any event.
 
template<class T >
T * GetSubsystem () const
 Template version of returning a subsystem.
 
const StringGetCategory () const
 Return object category. Categories are (optionally) registered along with the object factory. Return an empty string if the object category is not registered.
 
- Public Member Functions inherited from Urho3D::RefCounted
 RefCounted ()
 Construct. Allocate the reference count structure and set an initial self weak reference.
 
virtual ~RefCounted ()
 Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
 
void AddRef ()
 Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting.
 
void ReleaseRef ()
 Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting.
 
int Refs () const
 Return reference count.
 
int WeakRefs () const
 Return weak reference count.
 
RefCountRefCountPtr ()
 Return pointer to the reference count structure.
 

Static Public Member Functions

static void RegisterObject (Context *context)
 Register object factory.
 
- Static Public Member Functions inherited from Urho3D::UIElement
static void RegisterObject (Context *context)
 Register object factory.
 
- Static Public Member Functions inherited from Urho3D::Animatable
static void RegisterObject (Context *context)
 Register object factory.
 

Protected Attributes

Vector2 floatPosition_
 Floating point position.
 
IntVector2 hotSpot_
 Hotspot for positioning and rotation.
 
Vector2 scale_
 Scale.
 
float rotation_
 Rotation angle.
 
SharedPtr< Texturetexture_
 Texture.
 
IntRect imageRect_
 Image rectangle.
 
BlendMode blendMode_
 Blend mode flag.
 
Matrix3x4 transform_
 Transform matrix.
 
- Protected Attributes inherited from Urho3D::UIElement
String name_
 Name.
 
Vector< SharedPtr< UIElement > > children_
 Child elements.
 
UIElementparent_
 Parent element.
 
IntRect clipBorder_
 Child element clipping border.
 
Color color_ [MAX_UIELEMENT_CORNERS]
 Colors.
 
VariantMap vars_
 User variables.
 
int priority_
 Priority.
 
bool bringToFront_
 Bring to front when focused flag.
 
bool bringToBack_
 Bring to back when defocused flag.
 
bool clipChildren_
 Clip children flag.
 
bool sortChildren_
 Sort children according to priority flag.
 
bool useDerivedOpacity_
 Use derived opacity flag.
 
bool enabled_
 Input enabled flag.
 
bool enabledPrev_
 Last SetEnabled flag before any SetDeepEnabled.
 
bool editable_
 Value editable flag.
 
bool selected_
 Selected flag.
 
bool visible_
 Visible flag.
 
bool hovering_
 Hovering flag.
 
bool internal_
 Internally created flag.
 
FocusMode focusMode_
 Focus mode.
 
unsigned dragDropMode_
 Drag and drop flags.
 
LayoutMode layoutMode_
 Layout mode.
 
int layoutSpacing_
 Layout spacing.
 
IntRect layoutBorder_
 Layout borders.
 
Vector2 layoutFlexScale_
 Layout flex scale.
 
unsigned resizeNestingLevel_
 Resize nesting level to prevent multiple events and endless loop.
 
unsigned layoutNestingLevel_
 Layout update nesting level to prevent endless loop.
 
int layoutMinSize_
 Layout element minimum size in layout direction.
 
int layoutMaxSize_
 Layout element maximum size in layout direction.
 
int indent_
 Horizontal indentation.
 
int indentSpacing_
 Indent spacing (number of pixels per indentation level).
 
IntVector2 position_
 Position.
 
IntVector2 screenPosition_
 Screen position.
 
bool positionDirty_
 Screen position dirty flag.
 
String appliedStyle_
 Applied style.
 
int dragButtonCombo_
 Drag button combo.
 
unsigned dragButtonCount_
 Drag button count.
 
- Protected Attributes inherited from Urho3D::Animatable
bool animationEnabled_
 Animation enabled.
 
SharedPtr< ObjectAnimationobjectAnimation_
 Animation.
 
HashSet< const AttributeInfo * > animatedNetworkAttributes_
 Animated network attribute set.
 
HashMap< String, SharedPtr
< AttributeAnimationInfo > > 
attributeAnimationInfos_
 Attribute animation infos.
 
- Protected Attributes inherited from Urho3D::Serializable
NetworkStatenetworkState_
 Network attribute state.
 
- Protected Attributes inherited from Urho3D::Object
Contextcontext_
 Execution context.
 

Private Member Functions

 OBJECT (Sprite)
 

Additional Inherited Members

- Protected Member Functions inherited from Urho3D::UIElement
virtual void OnAttributeAnimationAdded ()
 Handle attribute animation added.
 
virtual void OnAttributeAnimationRemoved ()
 Handle attribute animation removed.
 
virtual void SetObjectAttributeAnimation (const String &name, ValueAnimation *attributeAnimation, WrapMode wrapMode, float speed)
 Set object attribute animation internal.
 
void MarkDirty ()
 Mark screen position as needing an update.
 
bool RemoveChildXML (XMLElement &parent, const String &name) const
 Remove child XML element by matching attribute name.
 
bool RemoveChildXML (XMLElement &parent, const String &name, const String &value) const
 Remove child XML element by matching attribute name and value.
 
bool FilterUIStyleAttributes (XMLElement &dest, const XMLElement &styleElem) const
 Filter UI-style attributes in serialization process.
 
virtual bool FilterImplicitAttributes (XMLElement &dest) const
 Filter implicit attributes in serialization process.
 

Detailed Description

UI element which allows sub-pixel positioning and size, as well as rotation. Only other Sprites should be added as child elements.

Member Function Documentation

bool Urho3D::Sprite::IsWithinScissor ( const IntRect currentScissor)
virtual

Return whether is visible and inside a scissor rectangle and should be rendered.

Todo:
Implement properly, for now just checks visibility flag

Reimplemented from Urho3D::UIElement.


The documentation for this class was generated from the following files:
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/UI/Sprite.h
  • /home/travis/build/urho3d/Urho3D/Source/Urho3D/UI/Sprite.cpp