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:
parent
f16b93c391
commit
da3014bd54
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user