diff --git a/binding/input-binding.cpp b/binding/input-binding.cpp index 030743df..01556b32 100644 --- a/binding/input-binding.cpp +++ b/binding/input-binding.cpp @@ -217,21 +217,6 @@ RB_METHOD(inputJoystickInfo) { #undef POWERCASE #undef M_SYMBOL -RB_METHOD(inputRumble) { - RB_UNUSED_PARAM; - VALUE duration, strength, attack, fade; - rb_scan_args(argc, argv, "13", &duration, &strength, &attack, &fade); - - int dur = NUM2INT(duration); - int str = (NIL_P(strength)) ? 1 : NUM2INT(strength); - int att = (NIL_P(attack)) ? 0 : NUM2INT(attack); - int fad = (NIL_P(fade)) ? 0 : NUM2INT(fade); - - shState->input().rumble(dur, str, att, fad); - - return Qnil; -} - RB_METHOD(inputGetMode) { RB_UNUSED_PARAM; @@ -332,7 +317,6 @@ void inputBindingInit() { _rb_define_module_function(module, "mouse_y", inputMouseY); _rb_define_module_function(module, "joystick", inputJoystickInfo); - _rb_define_module_function(module, "rumble", inputRumble); _rb_define_module_function(module, "text_input", inputGetMode); _rb_define_module_function(module, "text_input=", inputSetMode); diff --git a/src/eventthread.cpp b/src/eventthread.cpp index 4242957d..0be60bd8 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -91,8 +91,6 @@ enum REQUEST_TEXTMODE, REQUEST_SETTINGS, - - REQUEST_RUMBLE, UPDATE_FPS, UPDATE_SCREEN_RECT, @@ -114,11 +112,9 @@ bool EventThread::allocUserEvents() EventThread::EventThread() : js(0), - hapt(0), fullscreen(false), showCursor(true), - joystickConnected(false), - hapticEffectId(0) + joystickConnected(false) {} void EventThread::process(RGSSThreadData &rtData) @@ -172,9 +168,7 @@ void EventThread::process(RGSSThreadData &rtData) SDL_DisplayMode dm = {0}; SDL_GetWindowSize(win, &winW, &winH); - - SDL_Haptic *hap; - memset(&hapticEffect, 0, sizeof(SDL_HapticEffect)); + textInputBuffer.clear(); SettingsMenu *sMenu = 0; @@ -387,25 +381,12 @@ void EventThread::process(RGSSThreadData &rtData) js = SDL_JoystickOpen(0); joystickConnected = true; - - hap = SDL_HapticOpenFromJoystick(js); - Debug() << (hap ? "true" : "false"); - if (hap && (SDL_HapticQuery(hap) & SDL_HAPTIC_SINE)) - { - hapt = hap; - Debug() << "Haptic device initialized"; - } - else - { - Debug() << "No haptic support found"; - } break; case SDL_JOYDEVICEREMOVED : resetInputStates(); joystickConnected = false; - hapt = 0; break; case SDL_MOUSEBUTTONDOWN : @@ -500,25 +481,6 @@ void EventThread::process(RGSSThreadData &rtData) } sMenu->raise(); - break; - - case REQUEST_RUMBLE : - if (!hapt) break; - if (!hapticEffect.type) - { - hapticEffect.type = SDL_HAPTIC_SINE; - hapticEffect.constant.attack_level = 0; - hapticEffect.constant.fade_level = 0; - hapticEffectId = SDL_HapticNewEffect(hapt, &hapticEffect); - } - if (hapticEffect.constant.length == 0 && SDL_HapticGetEffectStatus(hapt, hapticEffectId) > 0) - { - SDL_HapticStopEffect(hapt, hapticEffectId); - break; - } - SDL_HapticUpdateEffect(hapt, hapticEffectId, &hapticEffect); - - SDL_HapticRunEffect(hapt, hapticEffectId, 1); break; case UPDATE_FPS : @@ -732,19 +694,6 @@ void EventThread::requestSettingsMenu() SDL_PushEvent(&event); } -void EventThread::requestRumble(int duration, short strength, int attack, int fade) -{ - SDL_Event event; - event.type = usrIdStart + REQUEST_RUMBLE; - - hapticEffect.constant.length = duration; - hapticEffect.constant.level = strength; - hapticEffect.constant.attack_length = attack; - hapticEffect.constant.fade_length = fade; - - SDL_PushEvent(&event); -} - void EventThread::showMessageBox(const char *body, int flags) { msgBoxDone.clear(); @@ -781,11 +730,6 @@ SDL_Joystick *EventThread::joystick() const return (joystickConnected) ? js : 0; } -SDL_Haptic *EventThread::haptic() const -{ - return hapt; -} - void EventThread::notifyFrame() { if (!fps.sendUpdates) diff --git a/src/eventthread.h b/src/eventthread.h index e78b1e67..4355633c 100644 --- a/src/eventthread.h +++ b/src/eventthread.h @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -97,8 +96,6 @@ public: void requestTextInputMode(bool mode); void requestSettingsMenu(); - - void requestRumble(int duration, short strength, int attack, int fade); void requestTerminate(); @@ -107,7 +104,6 @@ public: bool getJoystickConnected() const; SDL_Joystick *joystick() const; - SDL_Haptic *haptic() const; void showMessageBox(const char *body, int flags = 0); @@ -130,9 +126,6 @@ private: bool showCursor; SDL_Joystick *js; - SDL_Haptic *hapt; - SDL_HapticEffect hapticEffect; - int hapticEffectId; AtomicFlag msgBoxDone; diff --git a/src/input/input.cpp b/src/input/input.cpp index f014f6cc..305cc09f 100644 --- a/src/input/input.cpp +++ b/src/input/input.cpp @@ -1198,18 +1198,6 @@ int Input::getJoystickPowerLevel() SDL_JOYSTICK_POWER_UNKNOWN; } -void Input::rumble(int duration, int strength, int attack, int fade) -{ - duration = clamp(duration, 0, 10000); - strength = clamp(strength, 1, 100); - attack = clamp(attack, 0, 10000); - fade = clamp(fade, 0, 10000); - shState->eThread().requestRumble(duration, - (short)((double)strength / 100 * 32767), - attack, - fade); -} - bool Input::getTextInputMode() { return (SDL_IsTextInputActive() == SDL_TRUE); diff --git a/src/input/input.h b/src/input/input.h index 7b0b8b12..1fb4d505 100644 --- a/src/input/input.h +++ b/src/input/input.h @@ -71,9 +71,7 @@ public: bool getJoystickConnected(); const char *getJoystickName(); int getJoystickPowerLevel(); - - void rumble(int duration, int strength, int attack, int fade); - + bool getTextInputMode(); void setTextInputMode(bool mode); const char *getText(); diff --git a/src/main.cpp b/src/main.cpp index 89b927d9..ade0a0c0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) { #endif /* initialize SDL first */ - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) < 0) { + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) { showInitError(std::string("Error initializing SDL: ") + SDL_GetError()); return 0; }