Changeset 1355 for trunk/src/input/stick.cpp
 Timestamp:
 May 9, 2012, 6:40:38 PM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/input/stick.cpp
r1342 r1355 33 33 34 34 private: 35 Array<float> m_axes; 36 Array<int> m_buttons; 35 /* First element is the remap target */ 36 Array<int, float> m_axes; 37 Array<int, int> m_buttons; 37 38 } 38 39 stickdata; … … 56 57 m_data>m_axes.Empty(); 57 58 for (int i = 0; i < n; i++) 58 m_data>m_axes.Push( 0.f);59 m_data>m_axes.Push(i, 0.f); 59 60 } 60 61 … … 63 64 m_data>m_buttons.Empty(); 64 65 for (int i = 0; i < n; i++) 65 m_data>m_buttons.Push( 0);66 m_data>m_buttons.Push(i, 0); 66 67 } 67 68 68 69 void Stick::SetAxis(int n, float val) 69 70 { 70 m_data>m_axes[ n]= val;71 m_data>m_axes[m_data>m_axes[n].m1].m2 = val; 71 72 } 72 73 73 74 void Stick::SetButton(int n, int val) 74 75 { 75 m_data>m_buttons[n] = val; 76 m_data>m_buttons[m_data>m_buttons[n].m1].m2 = val; 77 } 78 79 void Stick::RemapAxis(int src, int dst) 80 { 81 m_data>m_axes[src].m1 = dst; 82 } 83 84 void Stick::RemapButton(int src, int dst) 85 { 86 m_data>m_buttons[src].m1 = dst; 76 87 } 77 88 … … 88 99 float Stick::GetAxis(int n) 89 100 { 90 return m_data>m_axes[n] ;101 return m_data>m_axes[n].m2; 91 102 } 92 103 93 104 int Stick::GetButton(int n) 94 105 { 95 return m_data>m_buttons[n] ;106 return m_data>m_buttons[n].m2; 96 107 } 97 108
Note: See TracChangeset
for help on using the changeset viewer.