mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 06:13:45 -07:00
Only display controller entry if pad connected
This commit is contained in:
parent
bec0cd47d9
commit
36c66edf3a
4 changed files with 4 additions and 1 deletions
|
@ -21,6 +21,7 @@ namespace Ship {
|
|||
virtual void ReadFromSource() = 0;
|
||||
virtual void WriteToSource(ControllerCallback* controller) = 0;
|
||||
virtual bool CanRumble() const = 0;
|
||||
virtual bool Connected() = 0;
|
||||
bool isRumbling;
|
||||
|
||||
void SetButtonMapping(const std::string& szButtonName, int32_t dwScancode);
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace Ship {
|
|||
void ReadFromSource();
|
||||
void WriteToSource(ControllerCallback* controller);
|
||||
bool CanRumble() const { return false; }
|
||||
bool Connected() { return true; }
|
||||
|
||||
bool PressButton(int32_t dwScancode);
|
||||
bool ReleaseButton(int32_t dwScancode);
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Ship {
|
|||
void ReadFromSource();
|
||||
void WriteToSource(ControllerCallback* controller);
|
||||
bool CanRumble() const { return SDL_GameControllerHasRumble(Cont); }
|
||||
bool Connected() { return Cont != nullptr; }
|
||||
|
||||
std::string GetGuid() { return guid; };
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ namespace SohImGui {
|
|||
if (ImGui::BeginMenu("Controller")) {
|
||||
for (const auto& [i, controllers] : Ship::Window::Controllers) {
|
||||
bool hasPad = std::find_if(controllers.begin(), controllers.end(), [](const auto& c) {
|
||||
return c->HasPadConf();
|
||||
return c->HasPadConf() && c->Connected();
|
||||
}) != controllers.end();
|
||||
|
||||
if (!hasPad) continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue