Переглянути джерело

Handle internal SDL_EVENT_FINGER_CANCELED events.

Sasha Szpakowski 7 місяців тому
батько
коміт
38168d4857
2 змінених файлів з 2 додано та 1 видалено
  1. 1 1
      src/modules/event/sdl/Event.cpp
  2. 1 0
      src/modules/touch/sdl/Touch.cpp

+ 1 - 1
src/modules/event/sdl/Event.cpp

@@ -364,7 +364,7 @@ Message *Event::convert(const SDL_Event &e)
 
 		if (e.type == SDL_EVENT_FINGER_DOWN)
 			txt = "touchpressed";
-		else if (e.type == SDL_EVENT_FINGER_UP)
+		else if (e.type == SDL_EVENT_FINGER_UP || e.type == SDL_EVENT_FINGER_CANCELED)
 			txt = "touchreleased";
 		else
 			txt = "touchmoved";

+ 1 - 0
src/modules/touch/sdl/Touch.cpp

@@ -86,6 +86,7 @@ void Touch::onEvent(Uint32 eventtype, const TouchInfo &info)
 		break;
 	}
 	case SDL_EVENT_FINGER_UP:
+	case SDL_EVENT_FINGER_CANCELED:
 		touches.erase(std::remove_if(touches.begin(), touches.end(), compare), touches.end());
 		break;
 	default: