1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Haptic feedback and increased dead zone

This commit is contained in:
Michael 2023-08-27 21:40:56 +02:00 committed by GitHub
parent f16b93c391
commit da3014bd54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -20,6 +20,7 @@
#include "../adventureMap/AdventureMapInterface.h"
#include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h"
#include "../eventsSDL/InputHandler.h"
#include "../../lib/CConfigHandler.h"
#include "../../lib/mapObjects/CGHeroInstance.h"
@ -118,6 +119,14 @@ void MapViewController::modifyTileSize(int stepsChange)
actualZoom.x = defaultTileSize;
if(actualZoom.y >= defaultTileSize - zoomTileDeadArea && actualZoom.y <= defaultTileSize + zoomTileDeadArea)
actualZoom.y = defaultTileSize;
bool isInDeadZone = targetTileSize != actualZoom;
if(!wasInDeadZone && isInDeadZone)
GH.input().hapticFeedback();
wasInDeadZone = isInDeadZone;
setTileSize(actualZoom);
}
}

View File

@ -51,8 +51,9 @@ class MapViewController : public IMapObjectObserver
private:
const int defaultTileSize = 32;
const int zoomTileDeadArea = 4;
const int zoomTileDeadArea = 5;
Point targetTileSize = Point(32, 32);
bool wasInDeadZone = true;
bool isEventInstant(const CGObjectInstance * obj);
bool isEventVisible(const CGObjectInstance * obj);