Lines Matching defs:js
47 LinuxJoyStick::LinuxJoyStick(InputManager* creator, bool buffered, const JoyStickInfo& js)
48 : JoyStick(js.vendor, buffered, js.devId, creator)
50 mJoyStick = js.joyFileD;
53 mState.mAxes.resize(js.axes);
55 mState.mButtons.resize(js.buttons);
57 mPOVs = js.hats;
59 mButtonMap = js.button_map;
60 mAxisMap = js.axis_map;
61 mRanges = js.axis_range;
97 input_event js[JOY_BUFFERSIZE];
100 int ret = read(mJoyStick, &js, sizeof(struct input_event) * JOY_BUFFERSIZE);
108 switch(js[i].type)
112 int button = mButtonMap[js[i].code];
115 cout << "\nButton Code: " << js[i].code << ", OIS Value: " << button << endl;
119 if(js[i].value)
137 if( js[i].code <= ABS_BRAKE )
139 int axis = mAxisMap[js[i].code];
147 mState.mAxes[axis].abs = js[i].value;
151 float proportion = (float)(js[i].value-mRanges[axis].max)/(float)(mRanges[axis].min-mRanges[axis].max);
155 else if( js[i].code <= ABS_HAT3Y ) //A POV - Max four POVs allowed
159 unsigned char LinuxPovNumber = js[i].code - 16;
170 if( js[i].value == -1 ) //Left
172 else if( js[i].value == 1 ) //Right
180 if( js[i].value == -1 ) //Up
182 else if( js[i].value == 1 ) //Down
227 JoyStickInfo js;
229 js.devId = mDevID;
230 js.joyFileD = mJoyStick;
231 js.vendor = mVendor;
232 js.axes = (int)mState.mAxes.size();
233 js.buttons = (int)mState.mButtons.size();
234 js.hats = mPOVs;
235 js.button_map = mButtonMap;
236 js.axis_map = mAxisMap;
237 js.axis_range = mRanges;
239 return js;
262 JoyStickInfo js;
263 if( EventUtils::isJoyStick(fd, js) )
265 joys.push_back(js);