VObject.h
Engine/source/Verve/Core/VObject.h
Classes:
class
Public Defines
define
Detailed Description
Public Defines
VObjectRep()
1 2//----------------------------------------------------------------------------- 3// Verve 4// Copyright (C) 2014 - Violent Tulip 5// 6// Permission is hereby granted, free of charge, to any person obtaining a copy 7// of this software and associated documentation files (the "Software"), to 8// deal in the Software without restriction, including without limitation the 9// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10// sell copies of the Software, and to permit persons to whom the Software is 11// furnished to do so, subject to the following conditions: 12// 13// The above copyright notice and this permission notice shall be included in 14// all copies or substantial portions of the Software. 15// 16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22// IN THE SOFTWARE. 23//----------------------------------------------------------------------------- 24#ifndef _VT_VOBJECT_H_ 25#define _VT_VOBJECT_H_ 26 27#ifndef _VT_VERVECONFIG_H_ 28#include "Verve/VerveConfig.h" 29#endif 30 31#ifdef VT_EDITOR 32 #ifndef _SIMOBJECT_H_ 33 #include "console/simObject.h" 34 #endif 35 36 #define VObjectRep SimObject 37#else 38 #ifndef _CONSOLEOBJECT_H_ 39 #include "console/consoleObject.h" 40 #endif 41 42 #define VObjectRep ConsoleObject 43#endif 44 45#ifndef _VT_VTREENODE_H_ 46#include "Verve/Core/VTreeNode.h" 47#endif 48 49#ifndef TINYXML_INCLUDED 50#include "tinyxml/tinyxml.h" 51#endif 52 53//----------------------------------------------------------------------------- 54class VController; 55//----------------------------------------------------------------------------- 56 57class VObject : public VObjectRep, 58 public VTreeNode 59{ 60 typedef VObjectRep Parent; 61 62protected: 63 64 VController *mController; 65 66 String mLabel; 67 bool mEnabled; 68 69public: 70 71 VObject( void ); 72 virtual ~VObject( void ); 73 74 static void initPersistFields( void ); 75 76 // Reference Methods. 77 78 VObject *getObject( const String &pLabel ); 79 template <class T> inline bool getObject( const String &pLabel, T *&pObject ) 80 { 81 // Reference Object. 82 pObject = dynamic_cast<T*>( getObject( pLabel ) ); 83 84 // Valid? 85 return ( pObject != NULL ); 86 } 87 88 // Console Declaration. 89 90 DECLARE_CONOBJECT( VObject ); 91 92public: 93 94 // Property Methods. 95 96 inline VController *getController( void ) { return mController; }; 97 98 inline const String &getLabel( void ) const { return mLabel; }; 99 bool isEnabled( void ); 100 101 bool isControllerPlaying( void ); 102 bool isControllerPaused( void ); 103 bool isControllerStopped( void ); 104 bool isControllerPlayingForward( void ); 105 bool isControllerLooping( void ); 106 S32 getControllerTime( void ); 107 F32 getControllerTimeScale( void ); 108 S32 getControllerDuration( void ); 109 110 virtual void setLabel( const String &pLabel ); 111 void setLabelUnique( const String &pLabel ); 112 inline void setEnabled( const bool &pEnabled ) { mEnabled = pEnabled; }; 113 114 // Callback Methods. 115 116 virtual void onAttach( void ); 117 virtual void onDetach( void ); 118 119 // Static Methods. 120 121 static bool setEnabled( void *pObject, const char *pArray, const char *pData ) { static_cast<VObject*>( pObject )->setEnabled( dAtob( pData ) ); return false; }; 122 static bool setLabel( void *pObject, const char *pArray, const char *pData ) { static_cast<VObject*>( pObject )->setLabel( pData ); return false; }; 123}; 124 125//----------------------------------------------------------------------------- 126 127#endif // _VT_VOBJECT_H_ 128