Browse Source

Do not show the cursor when using a touch device

pull/3178/head
Anders Jenbo 4 years ago
parent
commit
1ba7e07b29
  1. 1
      Source/controls/plrctrls.cpp
  2. 6
      Source/controls/touch/event_handlers.cpp
  3. 13
      Source/scrollrt.cpp
  4. 1
      Source/scrollrt.h

1
Source/controls/plrctrls.cpp

@ -26,6 +26,7 @@
namespace devilution {
bool sgbTouchActive = false;
bool sgbControllerActive = false;
Point speedspellscoords[50];
int speedspellcount = 0;

6
Source/controls/touch/event_handlers.cpp

@ -14,6 +14,8 @@
namespace devilution {
extern bool sgbTouchActive;
namespace {
VirtualGamepadEventHandler Handler(&VirtualGamepadState);
@ -86,12 +88,16 @@ void HandleBottomPanelInteraction(const SDL_Event &event)
void HandleTouchEvent(const SDL_Event &event)
{
sgbTouchActive = false;
if (Handler.Handle(event))
return;
if (!IsAnyOf(event.type, SDL_FINGERDOWN, SDL_FINGERUP, SDL_FINGERMOTION))
return;
sgbTouchActive = true;
SimulateMouseMovement(event);
if (HandleGameMenuInteraction(event))

13
Source/scrollrt.cpp

@ -251,7 +251,18 @@ void UndrawCursor(const Surface &out)
bool ShouldShowCursor()
{
return !(sgbControllerActive && !IsMovingMouseCursorWithController() && pcurs != CURSOR_TELEPORT && !invflag && (!chrflag || Players[MyPlayerId]._pStatPts <= 0));
if (!sgbControllerActive && !sgbTouchActive)
return true;
if (IsMovingMouseCursorWithController())
return true;
if (pcurs == CURSOR_TELEPORT)
return true;
if (invflag)
return true;
if (chrflag && Players[MyPlayerId]._pStatPts > 0)
return true;
return false;
}
/**

1
Source/scrollrt.h

@ -27,6 +27,7 @@ enum class ScrollDirection : uint8_t {
// Defined in SourceX/controls/plctrls.cpp
extern bool sgbControllerActive;
extern bool sgbTouchActive;
extern bool IsMovingMouseCursorWithController();
extern int LightTableIndex;

Loading…
Cancel
Save