summaryrefslogtreecommitdiffstats
path: root/matchblox/C_Hand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'matchblox/C_Hand.cpp')
-rw-r--r--matchblox/C_Hand.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/matchblox/C_Hand.cpp b/matchblox/C_Hand.cpp
new file mode 100644
index 0000000..8c4d977
--- /dev/null
+++ b/matchblox/C_Hand.cpp
@@ -0,0 +1,43 @@
+#include <GL/glut.h>
+#include "C_Hand.h"
+
+#define FADE_DURATION 500
+
+//duration of animations in ms
+unsigned int g_HandAnimDurations[3] = {0, 100, 100};
+
+
+C_Hand::C_Hand(const char* f_strFileName, GLuint f_uiTex,
+ MatProps_t f_Mat)
+: C_3DObject(f_strFileName, f_uiTex, f_Mat),
+ m_CurrState(HS_IDLE), m_uiAnimStart(0)
+{
+}
+
+
+void C_Hand::Render(unsigned int f_iElapsedTime)
+{
+ unsigned int l_uiDeltaTime = f_iElapsedTime - m_uiAnimStart;
+
+ if (l_uiDeltaTime > g_HandAnimDurations[(int)m_CurrState])
+ {
+ m_CurrState = HS_IDLE;
+ }
+
+ switch (m_CurrState)
+ {
+ case HS_GRAB:
+ C_3DObject::Render();
+ break;
+
+ case HS_RELEASE:
+ C_3DObject::Render();
+ break;
+
+ case HS_IDLE:
+ default:
+ C_3DObject::Render();
+ break;
+ }
+
+}