Settings widget mostly works
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
InputSettings::InputSettings(nlohmann::json &settings) : settings(settings) {
|
||||
int i = 0;
|
||||
for(auto& kb : kbButtons) {
|
||||
kb.setLabel(JSONGetField<std::string>(settings, "input", kb.getName()));
|
||||
auto field = JSONGetField<std::string>(settings, "input", kb.getName());
|
||||
kb.setLabel(field != "" ? field : "##unsetButton" + std::to_string(i++));
|
||||
}
|
||||
|
||||
devices.addItem({"Keyboard/Mouse"});
|
||||
@@ -33,13 +35,13 @@ bool InputSettings::render() {
|
||||
QueryDevices();
|
||||
PollGamepad();
|
||||
|
||||
if(i % 2 != 0) // only go down every 2 buttons... just... i like it this way
|
||||
if((i % 2 == 0) || i == 0) // only go down every 2 buttons... just... i like it this way
|
||||
ImGui::SameLine();
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return true;
|
||||
return modified;
|
||||
}
|
||||
|
||||
std::array<SDL_Keycode, 18> InputSettings::GetMappedKeys() {
|
||||
|
||||
Reference in New Issue
Block a user