Add the mouse for non-win32 devices if they are not a wiiu

This commit is contained in:
Maschell 2020-09-05 14:09:40 +02:00
parent 0dab74fd80
commit 7d38366aa0
3 changed files with 4 additions and 3 deletions

View File

@ -85,7 +85,7 @@ void ControllerManager::processEvent(SDL_JoystickID joystickId, int32_t channel,
channel = joystickToChannel[joystickId]; channel = joystickToChannel[joystickId];
} }
} }
if (channel != -1 && controllerList.contains(static_cast<const GuiTrigger::eChannels>(channel))) { if (channel != -1 && controllerList.count(static_cast<const GuiTrigger::eChannels>(channel)) > 0) {
controllerList[static_cast<GuiTrigger::eChannels>(channel)]->update(e, screenWidth, screenHeight); controllerList[static_cast<GuiTrigger::eChannels>(channel)]->update(e, screenWidth, screenHeight);
} }
} }

View File

@ -75,7 +75,8 @@ int main(int argc, char *args[]) {
auto * controllerM = new ControllerManager(system->getWidth(), system->getHeight()); auto * controllerM = new ControllerManager(system->getWidth(), system->getHeight());
#if defined _WIN32 #ifndef __WIIU__
// On non-Wii-U devices we expect a mouse.
controllerM->attachController(GuiTrigger::CHANNEL_1, new SDLControllerMouse(GuiTrigger::CHANNEL_1)); controllerM->attachController(GuiTrigger::CHANNEL_1, new SDLControllerMouse(GuiTrigger::CHANNEL_1));
DEBUG_FUNCTION_LINE("Added mouse"); DEBUG_FUNCTION_LINE("Added mouse");
#endif #endif

View File

@ -81,7 +81,7 @@ MainWindow::MainWindow(int32_t w, int32_t h, Renderer* renderer) : GuiFrame(w, h
DEBUG_FUNCTION_LINE("Failed to add image"); DEBUG_FUNCTION_LINE("Failed to add image");
return; return;
} }
button = new GuiButton(image5->getWidth(), image5->getHeight()); button = new GuiButton(image5->getWidth(), image5->getHeight());
this->setAlignment(ALIGN_TOP_LEFT); this->setAlignment(ALIGN_TOP_LEFT);