SuperTuxKart
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
KartControl Class Reference

Public Types

enum  SkidControl { SC_NONE , SC_NO_DIRECTION , SC_LEFT , SC_RIGHT }
 The skidding control state: SC_NONE: not pressed; SC_NO_DIRECTION: pressed, but no steering; SC_LEFT/RIGHT: pressed in the specified direction.
 

Public Member Functions

void setSteer (float f)
 Sets the current steering value.
 
void setAccel (float f)
 Sets the acceleration.
 
void setBrake (bool b)
 Sets if the kart is braking.
 
void setNitro (bool b)
 Sets if the kart activates nitro.
 
void setSkidControl (SkidControl sc)
 Sets the skid control for this kart.
 
void setRescue (bool b)
 Returns if this kart wants to get rescued.
 
void setFire (bool b)
 Sets if the kart wants to fire.
 
void setLookBack (bool b)
 Sets if the kart wants to look (and therefore also fires) backwards.
 
void reset ()
 Resets all controls.
 
bool operator== (const KartControl &other)
 Tests if two KartControls are equal.
 
void saveState (BareNetworkString *buffer) const
 Copies the important data from this objects into a memory buffer.
 
void rewindTo (BareNetworkString *buffer)
 Restores this object from a previously saved memory buffer.
 
char getButtonsCompressed () const
 Compresses all buttons into a single byte.
 
void setButtonsCompressed (char c)
 Sets the buttons from a compressed (1 byte) representation.
 
float getSteer () const
 Returns the current steering value in [-1, 1].
 
float getAccel () const
 Returns current acceleration in [0, 1].
 
bool getBrake () const
 Returns if the kart is braking.
 
bool getNitro () const
 Returns if the kart activates nitro.
 
SkidControl getSkidControl () const
 Returns the skidding control state: SC_NONE: not pressed; SC_NO_DIRECTION: pressed, but no steering; SC_LEFT/RIGHT: pressed in the specified direction.
 
bool getRescue () const
 Returns true if the kart triggered rescue.
 
bool getFire () const
 Returns if fire is selected.
 
bool getLookBack () const
 Returns if the kart wants to look back (which also implies that it will fire backwards.
 

Private Attributes

int16_t m_steer
 The current steering value in [-32767, 32767].
 
uint16_t m_accel
 Acceleration, in [0, 65535].
 
bool m_brake
 True if the kart brakes.
 
bool m_nitro
 True if the kart activates nitro.
 
SkidControl m_skid
 Skidding control state.
 
bool m_rescue
 True if rescue is selected.
 
bool m_fire
 True if fire is selected.
 
bool m_look_back
 True if the kart looks (and shoots) backwards.
 

Member Function Documentation

◆ setButtonsCompressed()

void KartControl::setButtonsCompressed ( char  c)
inline

Sets the buttons from a compressed (1 byte) representation.

/param c Character containing the compressed representation.


The documentation for this class was generated from the following files: