Oolite
Loading...
Searching...
No Matches
OOJoystickManager(Private) Category Reference

Instance Methods

(void) - setFunctionForAxis:function:stick:
(void) - setFunctionForButton:function:stick:

Detailed Description

Definition at line 34 of file OOJoystickManager.m.

Method Documentation

◆ setFunctionForAxis:function:stick:

- (void) setFunctionForAxis: (int) axis
function: (int) function
stick: (int) stickNum 

Extends class OOJoystickManager.

Definition at line 374 of file OOJoystickManager.m.

374 :(int)axis
375 function:(int)function
376 stick:(int)stickNum
377{
378 NSParameterAssert(axis < MAX_AXES && stickNum < MAX_STICKS);
379
380 int16_t axisvalue = [self getAxisWithStick:stickNum axis:axis];
381 [self unsetAxisFunction:function];
382 axismap[stickNum][axis] = function;
383
384 // initialize the throttle to what it's set to now (or else the
385 // commander has to waggle the throttle to wake it up). Other axes
386 // set as default.
387 if (function == AXIS_THRUST) {
388 axstate[function] = (float)(65536 - (axisvalue + 32768)) / 65536;
389 } else {
390 axstate[function] = (float)axisvalue / STICK_NORMALDIV;
391 }
392}
#define MAX_AXES
#define MAX_STICKS
@ AXIS_THRUST
#define STICK_NORMALDIV
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque

References AXIS_THRUST, OOJoystickManager::getAxisWithStick:axis:, MAX_AXES, MAX_STICKS, STICK_NORMALDIV, and OOJoystickManager::unsetAxisFunction:.

Referenced by OOJoystickManager::setFunction:withDict:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFunctionForButton:function:stick:

- (void) setFunctionForButton: (int) button
function: (int) function
stick: (int) stickNum 

Extends class OOJoystickManager.

Definition at line 394 of file OOJoystickManager.m.

394 :(int)button
395 function:(int)function
396 stick:(int)stickNum
397{
398 NSParameterAssert(button < MAX_BUTTONS && stickNum < MAX_STICKS);
399
400 int i, j;
401 for (i = 0; i < MAX_BUTTONS; i++) {
402 for (j = 0; j < MAX_STICKS; j++) {
403 if (buttonmap[j][i] == function) {
404 buttonmap[j][i] = STICK_NOFUNCTION;
405 break;
406 }
407 }
408 }
409 buttonmap[stickNum][button] = function;
410}
#define STICK_NOFUNCTION
#define MAX_BUTTONS

References MAX_BUTTONS, MAX_STICKS, and STICK_NOFUNCTION.

Referenced by OOJoystickManager::setFunction:withDict:.

Here is the caller graph for this function:

The documentation for this category was generated from the following file: