19#ifndef HEADER_KART_CONTROL_HPP
20#define HEADER_KART_CONTROL_HPP
35 enum SkidControl {SC_NONE, SC_NO_DIRECTION, SC_LEFT, SC_RIGHT};
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:53
Definition: kart_control.hpp:30
void setSteer(float f)
Sets the current steering value.
Definition: kart_control.cpp:27
SkidControl
The skidding control state: SC_NONE: not pressed; SC_NO_DIRECTION: pressed, but no steering; SC_LEFT/...
Definition: kart_control.hpp:35
int16_t m_steer
The current steering value in [-32767, 32767].
Definition: kart_control.hpp:39
bool getLookBack() const
Returns if the kart wants to look back (which also implies that it will fire backwards.
Definition: kart_control.hpp:152
bool m_brake
True if the kart brakes.
Definition: kart_control.hpp:43
bool m_look_back
True if the kart looks (and shoots) backwards.
Definition: kart_control.hpp:53
bool getBrake() const
Returns if the kart is braking.
Definition: kart_control.hpp:134
bool getNitro() const
Returns if the kart activates nitro.
Definition: kart_control.hpp:137
void setFire(bool b)
Sets if the kart wants to fire.
Definition: kart_control.cpp:71
float getAccel() const
Returns current acceleration in [0, 1].
Definition: kart_control.hpp:131
void setBrake(bool b)
Sets if the kart is braking.
Definition: kart_control.cpp:43
void setNitro(bool b)
Sets if the kart activates nitro.
Definition: kart_control.cpp:50
bool m_fire
True if fire is selected.
Definition: kart_control.hpp:51
bool getFire() const
Returns if fire is selected.
Definition: kart_control.hpp:148
void reset()
Resets all controls.
Definition: kart_control.hpp:71
bool operator==(const KartControl &other)
Tests if two KartControls are equal.
Definition: kart_control.hpp:85
void setLookBack(bool b)
Sets if the kart wants to look (and therefore also fires) backwards.
Definition: kart_control.cpp:78
void setSkidControl(SkidControl sc)
Sets the skid control for this kart.
Definition: kart_control.cpp:57
char getButtonsCompressed() const
Compresses all buttons into a single byte.
Definition: kart_control.hpp:104
uint16_t m_accel
Acceleration, in [0, 65535].
Definition: kart_control.hpp:41
bool m_rescue
True if rescue is selected.
Definition: kart_control.hpp:49
void saveState(BareNetworkString *buffer) const
Copies the important data from this objects into a memory buffer.
Definition: kart_control.cpp:84
void setButtonsCompressed(char c)
Sets the buttons from a compressed (1 byte) representation.
Definition: kart_control.hpp:117
void setRescue(bool b)
Returns if this kart wants to get rescued.
Definition: kart_control.cpp:64
SkidControl getSkidControl() const
Returns the skidding control state: SC_NONE: not pressed; SC_NO_DIRECTION: pressed,...
Definition: kart_control.hpp:142
bool m_nitro
True if the kart activates nitro.
Definition: kart_control.hpp:45
void rewindTo(BareNetworkString *buffer)
Restores this object from a previously saved memory buffer.
Definition: kart_control.cpp:93
bool getRescue() const
Returns true if the kart triggered rescue.
Definition: kart_control.hpp:145
SkidControl m_skid
Skidding control state.
Definition: kart_control.hpp:47
float getSteer() const
Returns the current steering value in [-1, 1].
Definition: kart_control.hpp:128
void setAccel(float f)
Sets the acceleration.
Definition: kart_control.cpp:35
Declares the general types that are used by the network.