AppEasy Core SDK
1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
|
00001 // 00002 // 00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine 00004 // 00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk 00006 // 00007 // For updates, tutorials and more details check out www.appeasymobile.com 00008 // 00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin. 00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support 00011 // 00012 // 00013 00014 #if !defined(_CZ_ACTOR_TILEMAP_H_) 00015 #define _CZ_ACTOR_TILEMAP_H_ 00016 00017 #include "CzActorImage.h" 00018 00019 /** 00020 @addtogroup Actors 00021 @{ 00022 */ 00023 00024 /** 00025 @class CzActorTilemap 00026 00027 @brief An actor that connects two points or two actors together like a string. 00028 00029 A Tilemap actor is an image actor that connects either two actors together or an actor to an anchor point. Tilemap actors are useful for creating all sorts of objects such as 00030 strings and ropes. 00031 00032 A Tilemap actor is declared using the ActorTilemap XOML tag. The ActorTilemap example has been provided to show how they work. Lets take a quick look at some example XOML: 00033 00034 @par XOML Example 00035 @code 00036 <ActorTilemap Name="Joiner1" Size="100, 20" Brush="Button1Brush" TargetA="Box1" TargetB="Box2" /> 00037 @endcode 00038 00039 The above XOML creates a Tilemap actor that connects Box1 and Box2 actors together using a visual Tilemap that is 20 units in width and covers 100% of the length of the Tilemap. 00040 00041 In addition to basic actor properties Tilemap actors have a number of new or changed properties, which include: 00042 - Size (length, width) - Size defines the width of the Tilemap as well as the length as apercentage of the distance between the two end points of the Tilemap. For example, if the 00043 length is set to 100% then the actor will stretch from the centre of target A to the centre of target B. If the length is less than 100% then the actor will fall short of the centre 00044 points of targets A and B; 00045 - TargetA (actor) - Defines the actor to fix the start point of the Tilemap actor 00046 - TargetB (actor) - Defines the actor to fix the end point of the Tilemap actor 00047 - OffsetA (x, y) - An amount to offset the connection point from Target A. If TargetA actor is not specified then this will be classed as a static scene position 00048 - OffsetB (x, y) - An amount to offset the connection point from Target B. If TargetB actor is not specified then this will be classed as a static scene position 00049 00050 */ 00051 00052 class CzActorTilemap : public CzActor 00053 { 00054 public: 00055 00056 protected: 00057 // Properties 00058 public: 00059 bool getProperty(unsigned int property_name, CzXomlProperty& prop); 00060 bool setProperty(unsigned int property_name, const CzXomlProperty& data, bool delta); 00061 bool setProperty(unsigned int property_name, const CzString& data, bool delta); 00062 // Properties end 00063 00064 protected: 00065 bool UpdateBinding(unsigned int property_name, CzXomlVariable* var); 00066 public: 00067 CzActorTilemap() : CzActor() { setActualClassType("tilemap"); } 00068 00069 bool Update(float dt); 00070 00071 // Implementation of IzXomlClass interface 00072 int LoadFromXoml(IzXomlResource* parent, bool load_children, CzXmlNode* node); 00073 00074 bool UpdateFromAnimation(CzAnimInstance *animation); 00075 00076 // Internal (used by XOML system to setup and cleanup the XOML class properties system 00077 protected: 00078 static CzXomlClassDef* ActorTilemapClassDef; // XOML class definition 00079 00080 public: 00081 static void InitClass(); 00082 static void ReleaseClass(); 00083 }; 00084 00085 /// @} 00086 00087 00088 /** 00089 @class CzActorTilemapCreator 00090 00091 @brief Creates an instance of a CzActorConnctor object. 00092 00093 Used by the XOML system to instantiate a CzActorTilemap object. 00094 00095 */ 00096 00097 class CzActorTilemapCreator : public IzXomlClassCreator 00098 { 00099 public: 00100 CzActorTilemapCreator() 00101 { 00102 setClassName("tilemap"); 00103 } 00104 IzXomlResource* CreateInstance(IzXomlResource* parent) { return new CzActorTilemap(); } 00105 }; 00106 00107 00108 00109 #endif // _CZ_ACTOR_TILEMAP_H_