Commit 21e4b332 authored by Phillip Castaneda's avatar Phillip Castaneda
Browse files

Adding joy patch - perform more reads per capture

parent d9b8990a
...@@ -31,7 +31,7 @@ restrictions: ...@@ -31,7 +31,7 @@ restrictions:
#include "OISPrereqs.h" #include "OISPrereqs.h"
//! Max number of elements to collect from buffered input //! Max number of elements to collect from buffered input
#define JOY_BUFFERSIZE 10 #define JOY_BUFFERSIZE 64
namespace OIS namespace OIS
{ {
......
...@@ -95,9 +95,11 @@ void LinuxJoyStick::capture() ...@@ -95,9 +95,11 @@ void LinuxJoyStick::capture()
//We are in non blocking mode - we just read once, and try to fill up buffer //We are in non blocking mode - we just read once, and try to fill up buffer
input_event js[JOY_BUFFERSIZE]; input_event js[JOY_BUFFERSIZE];
while(true)
{
int ret = read(mJoyStick, &js, sizeof(struct input_event) * JOY_BUFFERSIZE); int ret = read(mJoyStick, &js, sizeof(struct input_event) * JOY_BUFFERSIZE);
if( ret <= 0 ) if( ret < 0 )
return; break;
//Determine how many whole events re read up //Determine how many whole events re read up
ret /= sizeof(struct input_event); ret /= sizeof(struct input_event);
...@@ -190,13 +192,14 @@ void LinuxJoyStick::capture() ...@@ -190,13 +192,14 @@ void LinuxJoyStick::capture()
case EV_REL: //Relative Axes (Do any joystick actually have a relative axis?) case EV_REL: //Relative Axes (Do any joystick actually have a relative axis?)
#ifdef OIS_LINUX_JOY_DEBUG #ifdef OIS_LINUX_JOY_DEBUG
cout << "\nWarning: Relatives axes not supported yet" << endl; cout << "\nWarning: Relatives axes not supported yet" << endl;
#endif #endif
break; break;
default: break; default: break;
} }
} }
}
//All axes and POVs are combined into one movement per pair per captured frame //All axes and POVs are combined into one movement per pair per captured frame
if( mBuffered && mListener ) if( mBuffered && mListener )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment