mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-31 15:30:17 -05:00
Cleans up InputEditor class.
This commit is contained in:
parent
927ffd0b8b
commit
3792b03a7d
@ -165,7 +165,13 @@ namespace SohImGui {
|
||||
} else {
|
||||
console->Close();
|
||||
}
|
||||
SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0);
|
||||
|
||||
if (CVar_GetS32("gControllerConfigurationEnabled", 0)) {
|
||||
controller->Open();
|
||||
} else {
|
||||
controller->Close();
|
||||
}
|
||||
|
||||
UpdateAudio();
|
||||
});
|
||||
}
|
||||
@ -1096,7 +1102,11 @@ namespace SohImGui {
|
||||
bool currentValue = CVar_GetS32("gControllerConfigurationEnabled", 0);
|
||||
CVar_SetS32("gControllerConfigurationEnabled", !currentValue);
|
||||
needs_save = true;
|
||||
controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0);
|
||||
if (CVar_GetS32("gControllerConfigurationEnabled", 0)) {
|
||||
controller->Open();
|
||||
} else {
|
||||
controller->Close();
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleColor(1);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
@ -20,7 +20,7 @@ namespace Ship {
|
||||
return controlDeck->GetPhysicalDeviceFromVirtualSlot(slot);
|
||||
}
|
||||
|
||||
void InputEditor::DrawButton(const char* label, int n64Btn) {
|
||||
void InputEditor::DrawButton(const char* label, int32_t n64Btn) {
|
||||
const std::shared_ptr<Controller> backend = GetControllerPerSlot(CurrentPort);
|
||||
|
||||
float size = 40;
|
||||
@ -357,4 +357,16 @@ namespace Ship {
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
bool InputEditor::IsOpened() {
|
||||
return Opened;
|
||||
}
|
||||
|
||||
void InputEditor::Open() {
|
||||
Opened = true;
|
||||
}
|
||||
|
||||
void InputEditor::Close() {
|
||||
Opened = false;
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "stdint.h"
|
||||
#include "Lib/ImGui/imgui.h"
|
||||
|
||||
namespace Ship {
|
||||
|
||||
class InputEditor {
|
||||
int CurrentPort = 0;
|
||||
int BtnReading = -1;
|
||||
public:
|
||||
int32_t CurrentPort = 0;
|
||||
int32_t BtnReading = -1;
|
||||
bool Opened = false;
|
||||
public:
|
||||
void Init();
|
||||
void DrawButton(const char* label, int n64Btn);
|
||||
void DrawButton(const char* label, int32_t n64Btn);
|
||||
void DrawVirtualStick(const char* label, ImVec2 stick);
|
||||
void DrawControllerSchema();
|
||||
void DrawHud();
|
||||
bool IsOpened();
|
||||
void Open();
|
||||
void Close();
|
||||
};
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ extern "C" {
|
||||
pad->gyro_x = 0;
|
||||
pad->gyro_y = 0;
|
||||
|
||||
if (SohImGui::controller->Opened) return;
|
||||
if (SohImGui::controller->IsOpened()) return;
|
||||
|
||||
Ship::Window::GetInstance()->GetControlDeck()->WriteToPad(pad);
|
||||
Ship::ExecuteHooks<Ship::ControllerRead>(pad);
|
||||
|
Loading…
Reference in New Issue
Block a user