coastline 0.0.4
Loading...
Searching...
No Matches
controls.h File Reference
#include <array>
#include <cstddef>
#include <string>
#include <string_view>
#include <vector>
#include <SDL3/SDL.h>
Include dependency graph for controls.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  coastline::ControlPreset
 A set of bindings of every action, in the syntax of the Controls section. More...
struct  coastline::ControlSource
 A button or the half of an axis of a gamepad that drives an action. More...
class  coastline::ControlBindings
 Configured action sources, player devices, and stick dead zone for an input owner. More...

Namespaces

namespace  coastline

Enumerations

enum  coastline::ControlAction : std::size_t {
  coastline::CONTROL_STEER_LEFT , coastline::CONTROL_STEER_RIGHT , coastline::CONTROL_ACCELERATE , coastline::CONTROL_BRAKE ,
  coastline::CONTROL_REVERSE , coastline::CONTROL_GEAR_UP , coastline::CONTROL_GEAR_DOWN , coastline::CONTROL_COCKPIT_CAMERA ,
  coastline::CONTROL_BUMPER_CAMERA , coastline::CONTROL_CHASE_CAMERA , coastline::CONTROL_PAUSE_MENU_UP , coastline::CONTROL_PAUSE_MENU_DOWN ,
  coastline::CONTROL_PAUSE_MENU_SELECT , coastline::CONTROL_PAUSE , coastline::CONTROL_START_OR_RESPAWN , coastline::CONTROL_MENU_A ,
  coastline::CONTROL_MENU_B , coastline::CONTROL_MENU_Z , coastline::CONTROL_MENU_START , coastline::CONTROL_MENU_L ,
  coastline::CONTROL_MENU_R , coastline::CONTROL_MENU_C_UP , coastline::CONTROL_MENU_C_DOWN , coastline::CONTROL_MENU_C_LEFT ,
  coastline::CONTROL_MENU_C_RIGHT , coastline::CONTROL_MENU_D_UP , coastline::CONTROL_MENU_D_DOWN , coastline::CONTROL_MENU_D_LEFT ,
  coastline::CONTROL_MENU_D_RIGHT , coastline::CONTROL_MENU_STICK_LEFT , coastline::CONTROL_MENU_STICK_RIGHT , coastline::CONTROL_MENU_STICK_UP ,
  coastline::CONTROL_MENU_STICK_DOWN , coastline::CONTROL_ACTION_COUNT
}
 The actions of a gamepad the Controls section of BossRally.ini binds, in the order of keys. More...

Functions

constexpr ControlPreset coastline::RaceControlPreset (std::string_view name, const std::array< std::string_view, RACE_CONTROL_ACTIONS > &race)
void coastline::LoadControls (const GameConfig &config)
 Read the Controls section of config: the preset of the Preset key, the default for an absent or unknown preset, with each action key present replacing the binding of the preset, the device of each player, and the dead zone of the axes.
std::string_view coastline::PlayerDevice (std::size_t player)
bool coastline::IsControlAnalog (ControlAction action)
int coastline::ReadControl (SDL_Gamepad *gamepad, ControlAction action)

Variables

constexpr std::array< std::string_view, CONTROL_ACTION_COUNT > coastline::CONTROL_KEYS
 The keys of the Controls section, by ControlAction.
constexpr std::string_view coastline::CONTROL_PRESET_KEY = "Preset"
 The key of the Controls section that chooses a preset.
constexpr std::string_view coastline::DEAD_ZONE_KEY = "DeadZone"
 The key of the Controls section with the share of the travel of an axis that reads as 0.
constexpr std::array< std::string_view, 2 > coastline::PLAYER_DEVICE_KEYS {"Player1", "Player2"}
 The keys of the Controls section that choose the input device of each player.
constexpr ControlPreset coastline::DEFAULT_CONTROL_PRESET
 The preset of an absent or unknown Preset key.
constexpr std::size_t coastline::RACE_CONTROL_ACTIONS = CONTROL_CHASE_CAMERA + 1
 The actions of a race, from CONTROL_STEER_LEFT to CONTROL_CHASE_CAMERA.
constexpr std::array< ControlPreset, 7 > coastline::CONTROL_PRESETS
 The presets the Preset key chooses from, the first the default.
constexpr int coastline::CONTROL_FULL = 32768
 The magnitude of a button held down or of an axis at its end.