Warzone2100 / warzone2100

Command the forces of The Project in a battle to rebuild the world after mankind has been nearly destroyed by nuclear missiles. A 100% free and open source real-time strategy game for Windows, macOS, Linux, BSD+
https://wz2100.net
GNU General Public License v2.0
3.16k stars 524 forks source link

Inconsistent mouse camera controls #3104

Open maxsupermanhd opened 1 year ago

maxsupermanhd commented 1 year ago

In huge square map when panning camera both X and Y axis are panning with same speed but that's not the case on very narrow but long map.

4.3.3

maxsupermanhd commented 1 year ago

Note: faulty line is here, should be replaced with a configurable constant https://github.com/Warzone2100/warzone2100/blob/c8e597da4ec72fead9fe00edf5b03f1b12d23e29/src/display.cpp#L1210

Kim-jian commented 9 months ago

How about change like this?

  1. We can calculate the coefficients by dividing the short axis for the long axis on the map.
  2. It is corrected by multiplying the coefficient by the panning speed corresponding to the long axis. ex) if (mapWidth > mapHeight) { horizontalMovement = panXTracker->setTargetDelta(coef mouseDeltaX panningSpeed)->update()->getCurrentDelta(); verticalMovement = -1 panZTracker->setTargetDelta(mouseDeltaY panningSpeed)->update()->getCurrentDelta(); } else { horizontalMovement = panXTracker->setTargetDelta(mouseDeltaX panningSpeed)->update()->getCurrentDelta(); verticalMovement = -1 panZTracker->setTargetDelta(coef mouseDeltaY panningSpeed)->update()->getCurrentDelta(); }