mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 14:23:44 -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 ReadFromSource() = 0;
|
||||||
virtual void WriteToSource(ControllerCallback* controller) = 0;
|
virtual void WriteToSource(ControllerCallback* controller) = 0;
|
||||||
virtual bool CanRumble() const = 0;
|
virtual bool CanRumble() const = 0;
|
||||||
|
virtual bool Connected() = 0;
|
||||||
bool isRumbling;
|
bool isRumbling;
|
||||||
|
|
||||||
void SetButtonMapping(const std::string& szButtonName, int32_t dwScancode);
|
void SetButtonMapping(const std::string& szButtonName, int32_t dwScancode);
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace Ship {
|
||||||
void ReadFromSource();
|
void ReadFromSource();
|
||||||
void WriteToSource(ControllerCallback* controller);
|
void WriteToSource(ControllerCallback* controller);
|
||||||
bool CanRumble() const { return false; }
|
bool CanRumble() const { return false; }
|
||||||
|
bool Connected() { return true; }
|
||||||
|
|
||||||
bool PressButton(int32_t dwScancode);
|
bool PressButton(int32_t dwScancode);
|
||||||
bool ReleaseButton(int32_t dwScancode);
|
bool ReleaseButton(int32_t dwScancode);
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Ship {
|
||||||
void ReadFromSource();
|
void ReadFromSource();
|
||||||
void WriteToSource(ControllerCallback* controller);
|
void WriteToSource(ControllerCallback* controller);
|
||||||
bool CanRumble() const { return SDL_GameControllerHasRumble(Cont); }
|
bool CanRumble() const { return SDL_GameControllerHasRumble(Cont); }
|
||||||
|
bool Connected() { return Cont != nullptr; }
|
||||||
|
|
||||||
std::string GetGuid() { return guid; };
|
std::string GetGuid() { return guid; };
|
||||||
|
|
||||||
|
|
|
@ -349,7 +349,7 @@ namespace SohImGui {
|
||||||
if (ImGui::BeginMenu("Controller")) {
|
if (ImGui::BeginMenu("Controller")) {
|
||||||
for (const auto& [i, controllers] : Ship::Window::Controllers) {
|
for (const auto& [i, controllers] : Ship::Window::Controllers) {
|
||||||
bool hasPad = std::find_if(controllers.begin(), controllers.end(), [](const auto& c) {
|
bool hasPad = std::find_if(controllers.begin(), controllers.end(), [](const auto& c) {
|
||||||
return c->HasPadConf();
|
return c->HasPadConf() && c->Connected();
|
||||||
}) != controllers.end();
|
}) != controllers.end();
|
||||||
|
|
||||||
if (!hasPad) continue;
|
if (!hasPad) continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue