Guest User

Untitled

a guest
Aug 8th, 2013
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. diff --git a/trunk/dev/MSDK/MGui/Sources/X11/MJoystickLinux.cpp b/trunk/dev/MSDK/MGui/Sources/X11/MJoystickLinux.cpp
  2. index 9d1e85c..0d1a8de 100644
  3. --- a/trunk/dev/MSDK/MGui/Sources/X11/MJoystickLinux.cpp
  4. +++ b/trunk/dev/MSDK/MGui/Sources/X11/MJoystickLinux.cpp
  5. @@ -104,12 +104,12 @@ void MJoystickLinux::updateData()
  6. if(m_file == -1)
  7. return;
  8.  
  9. + fsync(m_file);
  10. read(m_file, &m_js, sizeof(struct js_event));
  11.  
  12. switch(m_js.type & ~JS_EVENT_INIT)
  13. {
  14. case JS_EVENT_AXIS:
  15. - //m_dAxis[m_js.number] = m_axis[m_js.number];
  16. m_axis[m_js.number] = m_js.value;
  17. m_dAxis[m_js.number] = m_js.value;
  18. m_dAxis[m_js.number] /= (float) JOY_AXIS_MAX;
  19. @@ -122,15 +122,3 @@ void MJoystickLinux::updateData()
  20.  
  21. }
  22.  
  23. -int main(int argc, char* argv[])
  24. -{
  25. - MJoystickLinux joystick(JOY1_DEV);
  26. -
  27. - while(1)
  28. - {
  29. - joystick.updateData();
  30. -
  31. - printf("Axis x = %f\n", joystick.getDeltaAxis(0));
  32. - fflush(stdout);
  33. - }
  34. -}
  35. \ No newline at end of file
  36. diff --git a/trunk/dev/MSDK/MGui/Sources/X11/MX11Window.cpp b/trunk/dev/MSDK/MGui/Sources/X11/MX11Window.cpp
  37. index 2bc7b73..d3d55b4 100644
  38. --- a/trunk/dev/MSDK/MGui/Sources/X11/MX11Window.cpp
  39. +++ b/trunk/dev/MSDK/MGui/Sources/X11/MX11Window.cpp
  40. @@ -213,7 +213,7 @@ static int translateKey(int keycode)
  41.  
  42. #ifdef linux
  43. static void updateJoystick(MJoystick* joystick, MJoystickLinux* joystickLinux,
  44. - MWindow* window)
  45. + MWindow* window, MWIN_EVENT_TYPE event)
  46. {
  47. joystickLinux->updateData();
  48.  
  49. @@ -234,12 +234,12 @@ static void updateJoystick(MJoystick* joystick, MJoystickLinux* joystickLinux,
  50. joystick->setX(joystickLinux->getDeltaAxis(0));
  51. joystick->setY(joystickLinux->getDeltaAxis(1));
  52. joystick->setZ(joystickLinux->getDeltaAxis(2));
  53. - joystick->setR(joystickLinux->getDeltaAxis(3));
  54. - joystick->setU(joystickLinux->getDeltaAxis(4));
  55. + joystick->setU(joystickLinux->getDeltaAxis(3));
  56. + joystick->setR(joystickLinux->getDeltaAxis(4));
  57. joystick->setV(joystickLinux->getDeltaAxis(5));
  58.  
  59. MWinEvent events;
  60. - events.type = MWIN_EVENT_JOYSTICK1_UPDATE;
  61. + events.type = event; // MWIN_EVENT_JOYSTICK1_UPDATE;
  62. window->sendEvents(&events);
  63.  
  64. joystick->flush();
  65. @@ -575,10 +575,10 @@ bool MWindow::onEvents(void)
  66. MWindow* window = MWindow::getInstance();
  67.  
  68. MJoystick* joystick = window->getJoystick1();
  69. - updateJoystick(joystick, &joystick1, window);
  70. + updateJoystick(joystick, &joystick1, window, MWIN_EVENT_JOYSTICK1_UPDATE);
  71.  
  72. joystick = window->getJoystick2();
  73. - updateJoystick(joystick, &joystick2, window);
  74. + updateJoystick(joystick, &joystick2, window, MWIN_EVENT_JOYSTICK2_UPDATE);
  75. #endif
  76.  
  77. return true;
Advertisement
Add Comment
Please, Sign In to add comment