16
16
17
17
#include " supertux/menu/multiplayer_player_menu.hpp"
18
18
19
+ #include " SDL.h"
20
+
19
21
#include " control/game_controller_manager.hpp"
20
22
#include " control/input_manager.hpp"
21
23
#include " control/joystick_manager.hpp"
22
24
#include " gui/dialog.hpp"
25
+ #include " supertux/gameconfig.hpp"
23
26
#include " supertux/game_session.hpp"
27
+ #include " supertux/globals.hpp"
24
28
#include " supertux/savegame.hpp"
25
29
#include " supertux/sector.hpp"
26
30
#include " object/player.hpp"
@@ -146,6 +150,30 @@ MultiplayerPlayerMenu::MultiplayerPlayerMenu(int player_id)
146
150
pair2.second = -1 ;
147
151
148
152
MenuManager::instance ().set_menu (std::make_unique<MultiplayerPlayerMenu>(player_id));
153
+
154
+ #if SDL_VERSION_ATLEAST(2, 0, 9)
155
+ if (g_config->multiplayer_buzz_controllers )
156
+ {
157
+ #if SDL_VERSION_ATLEAST(2, 0, 18)
158
+ if (SDL_GameControllerHasRumble (controller))
159
+ {
160
+ #endif
161
+ // TODO: Rumble intensity setting (like volume)
162
+ SDL_GameControllerRumble (controller, 0xFFFF , 0xFFFF , 300 );
163
+ #if SDL_VERSION_ATLEAST(2, 0, 18)
164
+ }
165
+ else
166
+ {
167
+ Dialog::show_message (_ (" This controller does not support rumbling;\n "
168
+ " please check the controllers manually." ));
169
+ }
170
+ #endif
171
+ }
172
+ #else
173
+ Dialog::show_message (_ (" This SuperTux build does not support rumbling\n "
174
+ " controllers; please check the controllers manually.\n "
175
+ " \n You may disable this message in the Options menu." ));
176
+ #endif
149
177
});
150
178
}
151
179
}
@@ -165,6 +193,30 @@ MultiplayerPlayerMenu::MultiplayerPlayerMenu(int player_id)
165
193
pair2.second = -1 ;
166
194
167
195
MenuManager::instance ().set_menu (std::make_unique<MultiplayerPlayerMenu>(player_id));
196
+
197
+ #if SDL_VERSION_ATLEAST(2, 0, 9)
198
+ if (g_config->multiplayer_buzz_controllers )
199
+ {
200
+ #if SDL_VERSION_ATLEAST(2, 0, 18)
201
+ if (SDL_JoystickHasRumbleTriggers (joystick))
202
+ {
203
+ #endif
204
+ // TODO: Rumble intensity setting (like volume)
205
+ SDL_JoystickRumble (joystick, 0xFFFF , 0xFFFF , 300 );
206
+ #if SDL_VERSION_ATLEAST(2, 0, 18)
207
+ }
208
+ else
209
+ {
210
+ Dialog::show_message (_ (" This joystick does not support rumbling;\n "
211
+ " please check the joysticks manually." ));
212
+ }
213
+ #endif
214
+ }
215
+ #else
216
+ Dialog::show_message (_ (" This SuperTux build does not support rumbling\n "
217
+ " joysticks; please check the joysticks manually.\n "
218
+ " \n You may disable this message in the Options menu." ));
219
+ #endif
168
220
});
169
221
}
170
222
}
0 commit comments