Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOJoystickManager(Private) Category Reference

Instance Methods

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

Detailed Description

Definition at line 36 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 33 of file OOJoystickManager.m.

411 :(int)axis
412 function:(int)function
413 stick:(int)stickNum
414{
415 NSParameterAssert(axis < MAX_AXES && stickNum < MAX_STICKS);
416
417 int16_t axisvalue = [self getAxisWithStick:stickNum axis:axis];
418 [self unsetAxisFunction:function];
419 axismap[stickNum][axis] = function;
420
421 // initialize the throttle to what it's set to now (or else the
422 // commander has to waggle the throttle to wake it up). Other axes
423 // set as default.
424 if(function == AXIS_THRUST)
425 {
426 axstate[function] = (float)(65536 - (axisvalue + 32768)) / 65536;
427 }
428 else
429 {
430 axstate[function] = (float)axisvalue / STICK_NORMALDIV;
431 }
432}
#define MAX_AXES
#define MAX_STICKS
@ AXIS_THRUST
#define STICK_NORMALDIV
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque

◆ setFunctionForButton:function:stick:

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

Extends class OOJoystickManager.

Definition at line 33 of file OOJoystickManager.m.

435 :(int)button
436 function:(int)function
437 stick:(int)stickNum
438{
439 NSParameterAssert(button < MAX_BUTTONS && stickNum < MAX_STICKS);
440
441 int i, j;
442 for (i = 0; i < MAX_BUTTONS; i++)
443 {
444 for (j = 0; j < MAX_STICKS; j++)
445 {
446 if (buttonmap[j][i] == function)
447 {
448 buttonmap[j][i] = STICK_NOFUNCTION;
449 break;
450 }
451 }
452 }
453 buttonmap[stickNum][button] = function;
454}
#define STICK_NOFUNCTION
#define MAX_BUTTONS

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