Closed datahead8888 closed 6 years ago
I am able to duplicate this.
I did try to add
void cJoystick::Init();
to tsc/src/core/main.cpp
but did not get that syntax working correctly, and places where I added code (when it did compile) did not have any effect to the bug.
On Ubuntu 17.10 SMFL version is 2.4.2 and joystick documentation is here
but did not get that syntax working correctly
Could you post the syntax error you got?
Otherwise, if you post your code in a branch, I could try to take a quick look at the compilation issue when I get a chance. It might go a bit slowly, though.
Hoping to tackle this soon...I mean, how hard could it be?
(Please don't answer that.)
I was about to say we can just re-init while polling for events, but there are apparently several places in the source code that discard any input events. Beautiful :ok_hand:.
I have a potential fix for this in the joy
branch, but my controller seems to either have broken or my drivers screwed up. If anyone can test it out, that would be great!!
I merged your joy
branch with commit a7c5aee7142d8e7de1a75ed6a0fa306d2f483fdb (untested). Comment if something breaks.
If a player connects a controller while playing, it should probably autoselect it if none is selected. Otherwise it's a bit tedious to go into the options menu and activate it.
Am 16. Mai 2020 um 21:18 Uhr -0700 schrieb Chris Jacobsen:
If a player connects a controller while playing, it should probably autoselect it if none is selected. Otherwise it's a bit tedious to go into the options menu and activate it.
I do not think this is possible. SFML does not issue an event for the connection of a controller.
-quintus
-- Blog: https://mg.guelker.eu
udev can be monitored for this on Linux, though I'm not sure about other platforms & it's not something that's supported on Flatpak since udev's protocol is not stable.
On Sun, May 17, 2020, 2:34 AM Marvin Gülker notifications@github.com wrote:
Am 16. Mai 2020 um 21:18 Uhr -0700 schrieb Chris Jacobsen:
If a player connects a controller while playing, it should probably autoselect it if none is selected. Otherwise it's a bit tedious to go into the options menu and activate it.
I do not think this is possible. SFML does not issue an event for the connection of a controller.
-quintus
-- Blog: https://mg.guelker.eu
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/Secretchronicles/TSC/issues/608#issuecomment-629756388, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM4YSI27MLCUGUIC7HWC6DRR6HPBANCNFSM4DG6HMVQ .
One could of course just poll the controller configuration via SFML again. That should work.
If you connect a game controller while playing TSC, it will not be detected in the menu until you restart the game executable. It does, however, let the player face left and right and/or move when starting a level. If you disconnect a game controller while playing TSC, then select "None" then "No Joystick" in the menu back and forth some times, the game segfaults.
It probably just needs to call cJoystick::Init() again at the appropriate place to run the SFML joystick detection logic, at least when the menus show up. It probably does not make sense repeatedly to call Joystick detection logic again and again during the main game loop, but I am open to other ideas.
I would consider the connection behavior a bug, as the menus should show the correct joystick connection state when accessed; players might want to connect a controller after starting the game. The seg fault is clearly a bug regardless.