summaryrefslogtreecommitdiffstats
path: root/matchblox/engine/C_Hand.cpp
blob: 8c4d97732aaec786eb0d6d7a069f96599bddc80f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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;
  }

}