Files
kaizen/src/frontend/InputSettings.hpp
2025-05-27 08:42:41 +02:00

63 lines
2.4 KiB
C++

#pragma once
#include <JSONUtils.hpp>
#include <unordered_map>
#include <ImGuiImpl/PushButton.hpp>
#include <ImGuiImpl/Combobox.hpp>
#include <SDL3/SDL.h>
class InputSettings final {
public:
bool grabbing = false;
int whichGrabbing = -1;
std::unordered_map<u32, std::string> gamepadIndexes{};
std::array<gui::PushButton, 18> kbButtons = {
gui::PushButton{"", "A"},
gui::PushButton{"", "B"},
gui::PushButton{"", "Z"},
gui::PushButton{"", "Start"},
gui::PushButton{"", "L"},
gui::PushButton{"", "R"},
gui::PushButton{"", "Dpad Up"},
gui::PushButton{"", "Dpad Down"},
gui::PushButton{"", "Dpad Left"},
gui::PushButton{"", "Dpad Right"},
gui::PushButton{"", "C Up"},
gui::PushButton{"", "C Down"},
gui::PushButton{"", "C Left"},
gui::PushButton{"", "C Right"},
gui::PushButton{"", "Analog Up"},
gui::PushButton{"", "Analog Down"},
gui::PushButton{"", "Analog Left"},
gui::PushButton{"", "Analog Right"},
};
gui::Combobox devices{"Device:", {}};
bool modified = false;
//std::unique_ptr<QHBoxLayout> AB = std::make_unique<QHBoxLayout>();
//std::unique_ptr<QHBoxLayout> ZStart = std::make_unique<QHBoxLayout>();
//std::unique_ptr<QHBoxLayout> LR = std::make_unique<QHBoxLayout>();
//std::unique_ptr<QHBoxLayout> DupDdown = std::make_unique<QHBoxLayout>();
//std::unique_ptr<QHBoxLayout> DleftDright = std::make_unique<QHBoxLayout>();
//std::unique_ptr<QHBoxLayout> CupCdown = std::make_unique<QHBoxLayout>();
//std::unique_ptr<QHBoxLayout> CleftCright = std::make_unique<QHBoxLayout>();
//std::unique_ptr<QHBoxLayout> AupAdown = std::make_unique<QHBoxLayout>();
//std::unique_ptr<QHBoxLayout> AleftAright = std::make_unique<QHBoxLayout>();
//std::unique_ptr<QVBoxLayout> mainLayout = std::make_unique<QVBoxLayout>();
//std::array<std::unique_ptr<QPushButton>, 18> kbButtons;
//std::array<std::unique_ptr<QLabel>, 18> buttonLabels;
//std::unique_ptr<QHBoxLayout> deviceComboBoxLayout = std::make_unique<QHBoxLayout>();
//QTimer refresh, pollGamepad;
//std::unique_ptr<QLabel> devicesLabel = std::make_unique<QLabel>("Device:");
//std::unique_ptr<QComboBox> devices = std::make_unique<QComboBox>();
//Q_OBJECT
bool render();
bool selectedDeviceIsNotKeyboard = false;
explicit InputSettings(nlohmann::json &);
void setModified(bool v) { modified = v; }
bool getModified() { return modified; }
nlohmann::json &settings;
std::array<SDL_Keycode, 18> GetMappedKeys();
};