mod_base::Joystick Class Reference

Joystick control of a Dyna, joystick calibration. More...

#include <mod_base_joystick.hh>

List of all members.

Public Types

enum  eMove {
  eMove_AT_CENTER, eMove_PITCH_UP, eMove_PITCH_DOWN, eMove_ROLL_LEFT,
  eMove_ROLL_RIGHT, eMove_YAW_LEFT, eMove_YAW_RIGHT, eMove_THROTTLE_SLOW,
  eMove_THROTTLE_FAST
}
enum  eAxis3 { eAxis3_DISABLED, eAxis3_THROTTLE, eAxis3_RUDDER }
 Config file stores these exact values. More...

Public Member Functions

 Joystick (void)
 ~Joystick ()
void Init (void)
bool IfEnabled (void)
bool Enable (bool enable=true)
bool Poll (void)
TinyArray< 3, Degree > GetResponse (void)
Percent GetResponsePercent (void)
void AdjustResponse (const Percent percent)
void SetResponse (Degree r0, Degree r1, Degree r2)
void SetResponseForEye (void)
void SetResponseForCraft (void)
bool SetAxis3 (eAxis3 a)
eAxis3 GetAxis3 (void)
void EnableAutofire (bool f)
void EnablePrint (bool f)
bool IfPrint (void)
void PrintRaw (int value, eMove move)
void RecordRaw (int value, eMove move)
bool IfCalibrationMode (void)
void SetCalibrationMode (bool f)
const ValuesGetValues (void)
void ResetValues (void)

Private Member Functions

void EnableInitial (void)
void EnableSubsequent (bool enable)
bool IfBeyondCenter (int lo)
fp PositionAbs (int high)

Private Attributes

CLASS_VAR int msInstanceCnt
bool mEnableInitial
 if Enable(true) was called (regardless if it succeeded or not)
inp::Joystick::Event mEvent
 dequeued from input queue (don't confuse with Joystick::mEvent)
eAxis3 mAxis3
bool mAutofire
bool mCalibrating
Values mValues
bool mPrint
TinyArray< 3, Degree > mResponsePotential
 potential response in degrees
TinyArray< 3, Degree > mResponse
 current response in terms of degree
Percent mResponsePercent
 current response in terms of percent

Friends

class TimerFunctor

Classes

class  TimerFunctor
class  Values
 For recording joystick values. Used for calibration. More...


Detailed Description

Joystick control of a Dyna, joystick calibration.

This is the client of the lower-level inp::Joystick. This is what does an action for a joystick event, and provides more functionality than inp::Joystick.

This class cannot be derived from inp::Joystick because of conflicting members (mEvent) and inp::Joystick is a global/singleton. Instead, this class is composed with (built over) inp::global.mJoystick.


Member Enumeration Documentation

enum mod_base::Joystick::eMove

Enumerator:
eMove_AT_CENTER 
eMove_PITCH_UP 
eMove_PITCH_DOWN 
eMove_ROLL_LEFT 
eMove_ROLL_RIGHT 
eMove_YAW_LEFT 
eMove_YAW_RIGHT 
eMove_THROTTLE_SLOW 
eMove_THROTTLE_FAST 

enum mod_base::Joystick::eAxis3

Config file stores these exact values.

Enumerator:
eAxis3_DISABLED 
eAxis3_THROTTLE 
eAxis3_RUDDER 


Constructor & Destructor Documentation

mod_base::Joystick::Joystick ( void   ) 

ctor/dtor.

mod_base::Joystick::~Joystick (  ) 


Member Function Documentation

void mod_base::Joystick::Init ( void   ) 

Should be called during startup even if joystick is disabled, in case disabled joystick is later enabled.

bool mod_base::Joystick::IfEnabled ( void   ) 

Returns:
True if joystick is enabled.

bool mod_base::Joystick::Enable ( bool  enable = true  ) 

Enable joystick.

Returns:
True if joystick is enabled.

bool mod_base::Joystick::Poll ( void   ) 

Poll joystick axises and buttons.

Returns:
False if no event was polled. A quirk in controlling the rudder using a button and the left/right axis is that the yaw action will be continued after the button is released. This isn't a problem as the user can intuitively stop the yaw by moving the axis to its center.

TinyArray< 3, Degree > mod_base::Joystick::GetResponse ( void   ) 

Get software's responsiveness to joystick movement.

Percent mod_base::Joystick::GetResponsePercent ( void   ) 

void mod_base::Joystick::AdjustResponse ( const Percent  percent  ) 

void mod_base::Joystick::SetResponse ( Degree  r0,
Degree  r1,
Degree  r2 
)

AdjustResponse() vs. SetResponse().

An automobile analogy:

SetResponse(Degree,Degree,Degree) sets the response at implied 50% (median).

void mod_base::Joystick::SetResponseForEye ( void   ) 

For aesthetic reasons, joystick response varies between first-persion view and chase-plane view.

void mod_base::Joystick::SetResponseForCraft ( void   ) 

bool mod_base::Joystick::SetAxis3 ( eAxis3  axis3  ) 

Set joystick axis for throttle or rudder control.

Joystick::eAxis3 mod_base::Joystick::GetAxis3 ( void   ) 

void mod_base::Joystick::EnableAutofire ( bool  f  ) 

Enable/disable autofire.

void mod_base::Joystick::EnablePrint ( bool  f  ) 

Enable/disable printing joystick settings/values.

bool mod_base::Joystick::IfPrint ( void   ) 

void mod_base::Joystick::PrintRaw ( int  value,
eMove  move 
)

Print raw joystick axis value (the values that come from Joystick class).

void mod_base::Joystick::RecordRaw ( int  value,
eMove  move 
)

Record raw joystick value.

bool mod_base::Joystick::IfCalibrationMode ( void   ) 

When in calibration mode, joystick events are recorded in a Joyval object but are otherwise ignored.

void mod_base::Joystick::SetCalibrationMode ( bool  f  ) 

const Values& mod_base::Joystick::GetValues ( void   )  [inline]

void mod_base::Joystick::ResetValues ( void   )  [inline]

void mod_base::Joystick::EnableInitial ( void   )  [private]

void mod_base::Joystick::EnableSubsequent ( bool  enable  )  [private]

bool mod_base::Joystick::IfBeyondCenter ( int  lo  )  [private]

Misc.

fp mod_base::Joystick::PositionAbs ( int  high  )  [private]

Returns:
An absolute fraction of the joystick's position in one axis. Close to 1 would be returned if the joystick is moved all the way.


Friends And Related Function Documentation

friend class TimerFunctor [friend]


Member Data Documentation

int mod_base::Joystick::msInstanceCnt [private]

bool mod_base::Joystick::mEnableInitial [private]

if Enable(true) was called (regardless if it succeeded or not)

inp::Joystick::Event mod_base::Joystick::mEvent [private]

dequeued from input queue (don't confuse with Joystick::mEvent)

eAxis3 mod_base::Joystick::mAxis3 [private]

bool mod_base::Joystick::mAutofire [private]

bool mod_base::Joystick::mCalibrating [private]

Values mod_base::Joystick::mValues [private]

bool mod_base::Joystick::mPrint [private]

TinyArray<3,Degree> mod_base::Joystick::mResponsePotential [private]

potential response in degrees

TinyArray<3,Degree> mod_base::Joystick::mResponse [private]

current response in terms of degree

Percent mod_base::Joystick::mResponsePercent [private]

current response in terms of percent


The documentation for this class was generated from the following files: Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:29 2007