Changeset 1355
- Timestamp:
- May 9, 2012, 6:40:38 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 3 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 -
trunk/src/input/stick.h
r1342 r1355 33 33 void SetAxis(int n, float val); 34 34 void SetButton(int n, int val); 35 void RemapAxis(int src, int dst); 36 void RemapButton(int src, int dst); 35 37 36 38 int GetAxisCount(); -
trunk/src/platform/sdl/sdlinput.cpp
r1346 r1355 68 68 stick->SetAxisCount(SDL_JoystickNumAxes(sdlstick)); 69 69 stick->SetButtonCount(SDL_JoystickNumButtons(sdlstick)); 70 71 /* It's possible to remap axes */ 72 if (strstr(name, "XBOX 360 For Windows")) 73 { 74 //stick->RemapAxis(4, 2); 75 //stick->RemapAxis(2, 4); 76 } 77 70 78 m_data->m_joysticks.Push(sdlstick, stick); 71 79 }
Note: See TracChangeset
for help on using the changeset viewer.