summaryrefslogtreecommitdiffstats
path: root/tools/statepropbuilder/inc/stateprop/stateprop.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/statepropbuilder/inc/stateprop/stateprop.hpp')
-rw-r--r--tools/statepropbuilder/inc/stateprop/stateprop.hpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/tools/statepropbuilder/inc/stateprop/stateprop.hpp b/tools/statepropbuilder/inc/stateprop/stateprop.hpp
new file mode 100644
index 0000000..4c0c766
--- /dev/null
+++ b/tools/statepropbuilder/inc/stateprop/stateprop.hpp
@@ -0,0 +1,86 @@
+#ifndef _STATEPROP_HPP_
+#define _STATEPROP_HPP_
+
+#include <radmath/radmath.hpp>
+
+#include <p3d/anim/compositedrawable.hpp>
+
+//=============================================================================
+// Forward Class/Struct Declarations
+//=============================================================================
+
+class tFrameController;
+class tAnimatedObject;
+class CStatePropData;
+class CStateProp;
+
+
+//=============================================================================
+// Class Declarations
+// PropListener
+//=============================================================================
+
+class CStatePropListener
+{
+public:
+ virtual void RecieveEvent( int callback , CStateProp* stateProp ) = 0;
+};
+
+//=============================================================================
+// Definitions
+//=============================================================================
+#define MAX_LISTENERS 10
+
+const int STATEPROP_CHANGE_STATE_EVENT = -1;
+
+//=============================================================================
+// Class Declarations
+// CStateProp
+//=============================================================================
+class CStateProp : public tEntity
+{
+public:
+
+ //Static function to create a new CStateProp instance
+ static CStateProp* CreateStateProp( CStatePropData* statePropData , unsigned int state = 0 );
+
+ CStateProp( tAnimatedObject* animatedObject , CStatePropData* statePropData , unsigned int state = 0 );
+ ~CStateProp();
+
+ //Per frame update
+ void Update( float dt );
+
+ //call before render
+ void UpdateFrameControllersForRender();
+
+ unsigned int GetState();
+ void SetState( unsigned int state );
+ void NextState();
+ void PrevState();
+
+ void OnEvent( unsigned int eventID );
+
+ void AddStatePropListener( CStatePropListener* statePropListener );
+ void RemoveStatePropListener( CStatePropListener* statePropListener );
+
+ tDrawable* GetDrawable();
+
+private:
+
+ //accessor helpers
+ unsigned int GetNumberOfFrameControllers();
+ tFrameController* GetFrameControllerByIndex( unsigned int i );
+ unsigned int GetNumberOfDrawableElements();
+ tCompositeDrawable::DrawableElement* GetDrawableElement( unsigned int i );
+
+ //Private members
+ CStatePropData* m_StatePropData;
+ tAnimatedObject* m_AnimatedObject;
+ tFrameController* m_BaseFrameController;
+ unsigned int m_CurrentState;
+
+ unsigned int m_NumStatePropListeners;
+ CStatePropListener* m_StatePropListener[MAX_LISTENERS];
+};
+
+#endif //_STATEPROP_HPP_ \ No newline at end of file