瀏覽代碼

use fps in calculation

Michael 2 年之前
父節點
當前提交
9f51f42128
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 3 0
      client/mapView/MapView.cpp
  2. 2 2
      client/mapView/MapView.h

+ 3 - 0
client/mapView/MapView.cpp

@@ -103,6 +103,9 @@ MapView::MapView(const Point & offset, const Point & dimensions)
 	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
 	actions = std::make_shared<MapViewActions>(*this, model);
 	actions->setContext(controller->getContext());
+
+	// catch min 10 frames
+	postSwipeCatchIntervalMs = static_cast<int>(10.0 * 1000.0 * (1.0 / settings["video"]["targetfps"].Float()));
 }
 
 void MapView::onMapLevelSwitched()

+ 2 - 2
client/mapView/MapView.h

@@ -52,8 +52,8 @@ class MapView : public BasicMapView
 	std::vector<std::pair<uint32_t, Point>> swipeHistory;
 	double postSwipeAngle = 0.0;
 	double postSwipeSpeed = 0.0;
-	
-	const int postSwipeCatchIntervalMs = 150;
+
+	int postSwipeCatchIntervalMs;
 	const double postSwipeSlowdownSpeed = 0.006;
 	const double postSwipeMinimalSpeed = 0.1;