/** * @file example_retroid.cpp * @brief * @author DeepRobotics * @version 1.0 * @date 2024-03-27 * * @copyright Copyright (c) 2024 DeepRobotics * */ #include #include "gamepad.h" #include "retroid_gamepad.h" #include "gamepad_keys.h" #include "fmt/format.h" #include "fmt/core.h" #include "fmt/chrono.h" void InitialRetroidKeys(RetroidGamepad& is){ is.button_status_.clear(); std::string pressed = fmt::format("\x1b[32m{:^20}\x1b[0m", "pressed"); std::string released = fmt::format("\x1b[37m{:^20}\x1b[0m", "released"); is.button_status_.push_back(released); is.button_status_.push_back(pressed); } /** * @brief Overloaded output stream operator for RetroidGamepad. * * Allows printing RetroidGamepad information to an output stream. * * @param o The output stream. * @param is The RetroidGamepad object. * @return Reference to the output stream. */ std::ostream& operator<<(std::ostream& o, RetroidGamepad& is){ RetroidKeys keys = is.GetKeys(); o << "\033c"; std::string s = fmt::format( "┌{0:─^{1}}┐\n" "│{2: ^{1}}│\n" "└{0:─^{1}}┘\n", "", 86 ,"Joystick Device: Retroid(Lite3)"); o<