Toast Engine
Loading...
Searching...
No Matches
keycodes.cpp File Reference

Implementation of the keycode parser. More...

#include "keycodes.hpp"
#include <SDL3/SDL_gamepad.h>
#include <SDL3/SDL_keyboard.h>
#include <SDL3/SDL_keycode.h>
#include <SDL3/SDL_mouse.h>
#include <cctype>
#include <charconv>
#include <optional>
#include <toast/log.hpp>
#include <unordered_map>
Include dependency graph for keycodes.cpp:

Functions

auto input::parseKeycode (std::string_view str) -> KeyCode
 Parses a textual keycode such as "keyboard/a", "mouse/left" or "controller/left_stick".

Detailed Description

Implementation of the keycode parser.

Author
Xein
Date
21 Jun 2026

Function Documentation

◆ parseKeycode()

auto TOAST_API input::parseKeycode ( std::string_view str) -> KeyCode
nodiscard

Parses a textual keycode such as "keyboard/a", "mouse/left" or "controller/left_stick".

Parameters
strThe keycode string; the device prefix selects the parsing path
Returns
A KeyCode with valid set to true on success, or valid false when the string is unknown