mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-11 20:11:18 +03:00
* Fix SDL related touch issues.
This commit is contained in:
@@ -38,6 +38,8 @@ public:
|
||||
// Also add these to allow proper text input within the game.
|
||||
bool shiftPressed() override;
|
||||
void setShiftPressed(bool b, bool isLeft);
|
||||
|
||||
bool isTouchscreen() override { return false; }
|
||||
|
||||
static MouseButtonType GetMouseButtonType(SDL_Event event);
|
||||
static bool GetMouseButtonState(SDL_Event event);
|
||||
|
||||
@@ -14,6 +14,7 @@ typedef AppPlatform_sdl UsedAppPlatform;
|
||||
#endif
|
||||
|
||||
#include "client/app/NinecraftApp.hpp"
|
||||
#include "client/player/input/Multitouch.hpp"
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
@@ -100,6 +101,7 @@ static void handle_events()
|
||||
{
|
||||
const float scale = g_fPointToPixelScale;
|
||||
Mouse::feed(AppPlatform_sdlbase::GetMouseButtonType(event), AppPlatform_sdlbase::GetMouseButtonState(event), event.button.x * scale, event.button.y * scale);
|
||||
Multitouch::feed(AppPlatform_sdlbase::GetMouseButtonType(event), AppPlatform_sdlbase::GetMouseButtonState(event), event.button.x * scale, event.button.y * scale, 0);
|
||||
break;
|
||||
}
|
||||
case SDL_MOUSEMOTION:
|
||||
@@ -108,6 +110,7 @@ static void handle_events()
|
||||
float x = event.motion.x * scale;
|
||||
float y = event.motion.y * scale;
|
||||
Mouse::feed(BUTTON_NONE, false, x, y);
|
||||
Multitouch::feed(BUTTON_NONE, false, x, y, 0);
|
||||
g_pAppPlatform->setMouseDiff(event.motion.xrel * scale, event.motion.yrel * scale);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user