Skip to content

Instantly share code, notes, and snippets.

@Milek7

Milek7/fix.diff Secret

Created December 6, 2020 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Milek7/8b0eaa3c87d315f5a2baf68b9c461176 to your computer and use it in GitHub Desktop.
Save Milek7/8b0eaa3c87d315f5a2baf68b9c461176 to your computer and use it in GitHub Desktop.
diff --git a/src/gfx.cpp b/src/gfx.cpp
index b5267e42a..19c06471b 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -1800,8 +1800,8 @@ void CursorVars::UpdateCursorPositionRelative(int delta_x, int delta_y)
int last_position_x = this->pos.x;
int last_position_y = this->pos.y;
- this->pos.x = Clamp(this->pos.x + delta_x, 0, _cur_resolution.width);
- this->pos.y = Clamp(this->pos.y + delta_y, 0, _cur_resolution.height);
+ this->pos.x = Clamp(this->pos.x + delta_x, 0, _cur_resolution.width - 1);
+ this->pos.y = Clamp(this->pos.y + delta_y, 0, _cur_resolution.height - 1);
this->delta.x = last_position_x - this->pos.x;
this->delta.y = last_position_y - this->pos.y;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment