![]() |
AppEasy Core SDK
1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
|
An actor that connects two points or two actors together like a string. More...
#include <CzActorConnector.h>
Public Member Functions | |
void | setTargetA (CzActor *target) |
CzActor * | getTargetA () |
void | setTargetB (CzActor *target) |
CzActor * | getTargetB () |
void | setOffsetA (float x, float y) |
CzVec2 | getOffsetA () const |
void | setOffsetB (float x, float y) |
CzVec2 | getOffsetB () const |
bool | getProperty (unsigned int property_name, CzXomlProperty &prop) |
bool | setProperty (unsigned int property_name, const CzXomlProperty &data, bool delta) |
Sets the named property of the ActorConnector. | |
bool | setProperty (unsigned int property_name, const CzString &data, bool delta) |
Sets the named property of the actor. | |
CzActorConnector () | |
bool | Update (float dt) |
Updates this actors logic. | |
int | LoadFromXoml (IzXomlResource *parent, bool load_children, CzXmlNode *node) |
Creates an instance of this class from XML. | |
bool | UpdateFromAnimation (CzAnimInstance *animation) |
Updates actor property from supplied animation. | |
Static Public Member Functions | |
static void | InitClass () |
Initialises the class. | |
static void | ReleaseClass () |
static bool | _setTargetA (IzXomlResource *target, const CzXomlProperty &prop, bool add) |
static CzXomlProperty | _getTargetA (IzXomlResource *target) |
static bool | _setTargetB (IzXomlResource *target, const CzXomlProperty &prop, bool add) |
static CzXomlProperty | _getTargetB (IzXomlResource *target) |
static bool | _setOffsetA (IzXomlResource *target, const CzXomlProperty &prop, bool add) |
static CzXomlProperty | _getOffsetA (IzXomlResource *target) |
static bool | _setOffsetB (IzXomlResource *target, const CzXomlProperty &prop, bool add) |
static CzXomlProperty | _getOffsetB (IzXomlResource *target) |
Protected Member Functions | |
bool | UpdateBinding (unsigned int property_name, CzXomlVariable *var) |
Updates an actor property from the supplied XOML variable. | |
Protected Attributes | |
CzActor * | TargetA |
Target actor A. | |
CzActor * | TargetB |
Target actor B. | |
CzVec2 | OffsetA |
Target A offset. | |
CzVec2 | OffsetB |
Target B offset. | |
Static Protected Attributes | |
static CzXomlClassDef * | ActorConnectorClassDef = NULL |
An actor that connects two points or two actors together like a string.
A connector actor is an image actor that connects either two actors together or an actor to an anchor point. Connector actors are useful for creating all sorts of objects such as strings and ropes.
A connector actor is declared using the ActorConnector XOML tag. The ActorConnector example has been provided to show how they work. Lets take a quick look at some example XOML:
The above XOML creates a connector actor that connects Box1 and Box2 actors together using a visual connector that is 20 units in width and covers 100% of the length of the connector.
In addition to basic actor properties connector actors have a number of new or changed properties, which include:
CzActorConnector::CzActorConnector | ( | ) | [inline] |
CzXomlProperty CzActorConnector::_getOffsetA | ( | IzXomlResource * | target | ) | [static] |
CzXomlProperty CzActorConnector::_getOffsetB | ( | IzXomlResource * | target | ) | [static] |
CzXomlProperty CzActorConnector::_getTargetA | ( | IzXomlResource * | target | ) | [static] |
CzXomlProperty CzActorConnector::_getTargetB | ( | IzXomlResource * | target | ) | [static] |
bool CzActorConnector::_setOffsetA | ( | IzXomlResource * | target, |
const CzXomlProperty & | prop, | ||
bool | add | ||
) | [static] |
bool CzActorConnector::_setOffsetB | ( | IzXomlResource * | target, |
const CzXomlProperty & | prop, | ||
bool | add | ||
) | [static] |
bool CzActorConnector::_setTargetA | ( | IzXomlResource * | target, |
const CzXomlProperty & | prop, | ||
bool | add | ||
) | [static] |
bool CzActorConnector::_setTargetB | ( | IzXomlResource * | target, |
const CzXomlProperty & | prop, | ||
bool | add | ||
) | [static] |
CzVec2 CzActorConnector::getOffsetA | ( | ) | const [inline] |
CzVec2 CzActorConnector::getOffsetB | ( | ) | const [inline] |
bool CzActorConnector::getProperty | ( | unsigned int | property_name, |
CzXomlProperty & | prop | ||
) | [virtual] |
Returns the named property of the actor. The properties value is returned in a CzXomlProperty which is a structure that contains a union of all possible property types.
property_name | Name of the property as a string hash (faster searching). | |
[in,out] | prop | The property. |
Reimplemented from CzActorImage.
CzActor* CzActorConnector::getTargetA | ( | ) | [inline] |
CzActor* CzActorConnector::getTargetB | ( | ) | [inline] |
void CzActorConnector::InitClass | ( | ) | [static] |
Initialises the class.
Sets up the classes avaiiable properties. Used by the XOML system to find, set amd get class properties.
Reimplemented from CzActorImage.
int CzActorConnector::LoadFromXoml | ( | IzXomlResource * | parent, |
bool | load_children, | ||
CzXmlNode * | node | ||
) | [virtual] |
Creates an instance of this class from XML.
LoadFromXoml is the main method used by all classes that can be instantiated from XOML mark-up. This method creates an instance of this class from the supplied XML node structure specified by node. if parent is not NULL then the created instance will utilise the supplied parent to determine where it should live within the app. For example, if the parent is a scene then the actor will be placed in that scene. if the parent is another actor then this actor will be placed into the scene of the supplied actor and linked as a child to the parent actor. If load_chlldren is true then any child nodes contained within the actor will also be loaded. Note that as CzActorConnector is derived from CzActor, CzActorImage::LoadFromXoml() will also be called to load CzActor specific properties.
[in] | parent | If non-null, the parent. |
load_children | true to load child nodes. | |
[in] | node | If non-null, the XOML markup node that defines this object |
Reimplemented from CzActorImage.
void CzActorConnector::ReleaseClass | ( | ) | [static] |
Reimplemented from CzActorImage.
void CzActorConnector::setOffsetA | ( | float | x, |
float | y | ||
) | [inline] |
void CzActorConnector::setOffsetB | ( | float | x, |
float | y | ||
) | [inline] |
bool CzActorConnector::setProperty | ( | unsigned int | property_name, |
const CzXomlProperty & | data, | ||
bool | delta | ||
) | [virtual] |
Sets the named property of the ActorConnector.
Sets the named property of this ActorConnector. The properties value supplied will be converted. If delta is set to true then the existing value of the property will be added to instead of replaced.
property_name | Name of the property as a string hash (faster searching). | |
[in] | data | The property data. |
delta | true if property should be added to instead of replaced. |
Reimplemented from CzActorImage.
bool CzActorConnector::setProperty | ( | unsigned int | property_name, |
const CzString & | data, | ||
bool | delta | ||
) | [virtual] |
Sets the named property of the actor.
Sets the named property of this actor. The properties value (data) is supplied as a string and will be converted. If delta is set to true then the existing value of the property will be added to instead of replaced. Note that as CzActorConnector is derived from CzActor, all CzActor properties will also be checked against.
property_name | Name of the property as a string hash (faster searching). | |
[in] | data | The property data. |
delta | true to property should be added to instead of replaced. |
Reimplemented from CzActorImage.
void CzActorConnector::setTargetA | ( | CzActor * | target | ) | [inline] |
void CzActorConnector::setTargetB | ( | CzActor * | target | ) | [inline] |
bool CzActorConnector::Update | ( | float | dt | ) | [virtual] |
Updates this actors logic.
Updates the actors logic, including calculating end points of the connector and the scale to fit to the specified size. In addition CzActorImage::Update() is called to perform the base actor update.
dt | The number of seconds since the app was last updated |
Reimplemented from CzActor.
bool CzActorConnector::UpdateBinding | ( | unsigned int | property_name, |
CzXomlVariable * | var | ||
) | [protected, virtual] |
Updates an actor property from the supplied XOML variable.
Updates a single property from the value of the bound XOML variable.
property_name | Name of the property. | |
[in,out] | var | If non-null, the variable. |
Reimplemented from CzActorImage.
bool CzActorConnector::UpdateFromAnimation | ( | CzAnimInstance * | animation | ) | [virtual] |
Updates actor property from supplied animation.
Updates the actors property that is specified by the supplied animation. When a timeline animation targets the property of an actor this method will be called by the animation to move the animations frame data into its target property.
[in] | animation | If non-null, the animation. |
Reimplemented from CzActorImage.
CzXomlClassDef * CzActorConnector::ActorConnectorClassDef = NULL [static, protected] |
CzVec2 CzActorConnector::OffsetA [protected] |
Target A offset.
CzVec2 CzActorConnector::OffsetB [protected] |
Target B offset.
CzActor* CzActorConnector::TargetA [protected] |
Target actor A.
CzActor* CzActorConnector::TargetB [protected] |
Target actor B.