mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-14 18:19:11 +00:00
(svn r18031) -Codechange: since basically r7157 adding up 'all' mouse movement isn't needed anymore because after each even that movement is handled and the counter is reset. As such simply assigning instead of adding works.
This commit is contained in:
src/video
@@ -379,8 +379,8 @@ static void PollEvent()
|
|||||||
int dy = mouse_y - _cursor.pos.y;
|
int dy = mouse_y - _cursor.pos.y;
|
||||||
if (dx != 0 || dy != 0) {
|
if (dx != 0 || dy != 0) {
|
||||||
if (_cursor.fix_at) {
|
if (_cursor.fix_at) {
|
||||||
_cursor.delta.x += dx;
|
_cursor.delta.x = dx;
|
||||||
_cursor.delta.y += dy;
|
_cursor.delta.y = dy;
|
||||||
position_mouse(_cursor.pos.x, _cursor.pos.y);
|
position_mouse(_cursor.pos.x, _cursor.pos.y);
|
||||||
} else {
|
} else {
|
||||||
_cursor.delta.x = dx;
|
_cursor.delta.x = dx;
|
||||||
|
@@ -385,8 +385,8 @@ static int PollEvent()
|
|||||||
int dx = ev.motion.x - _screen.width / 2;
|
int dx = ev.motion.x - _screen.width / 2;
|
||||||
int dy = ev.motion.y - _screen.height / 2;
|
int dy = ev.motion.y - _screen.height / 2;
|
||||||
if (dx != 0 || dy != 0) {
|
if (dx != 0 || dy != 0) {
|
||||||
_cursor.delta.x += dx;
|
_cursor.delta.x = dx;
|
||||||
_cursor.delta.y += dy;
|
_cursor.delta.y = dy;
|
||||||
SDL_CALL SDL_WarpMouse(_screen.width / 2, _screen.height / 2);
|
SDL_CALL SDL_WarpMouse(_screen.width / 2, _screen.height / 2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -433,8 +433,8 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
|||||||
int dx = x - _cursor.pos.x;
|
int dx = x - _cursor.pos.x;
|
||||||
int dy = y - _cursor.pos.y;
|
int dy = y - _cursor.pos.y;
|
||||||
if (dx != 0 || dy != 0) {
|
if (dx != 0 || dy != 0) {
|
||||||
_cursor.delta.x += dx;
|
_cursor.delta.x = dx;
|
||||||
_cursor.delta.y += dy;
|
_cursor.delta.y = dy;
|
||||||
|
|
||||||
pt.x = _cursor.pos.x;
|
pt.x = _cursor.pos.x;
|
||||||
pt.y = _cursor.pos.y;
|
pt.y = _cursor.pos.y;
|
||||||
@@ -443,8 +443,8 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
|
|||||||
SetCursorPos(pt.x, pt.y);
|
SetCursorPos(pt.x, pt.y);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_cursor.delta.x += x - _cursor.pos.x;
|
_cursor.delta.x = x - _cursor.pos.x;
|
||||||
_cursor.delta.y += y - _cursor.pos.y;
|
_cursor.delta.y = y - _cursor.pos.y;
|
||||||
_cursor.pos.x = x;
|
_cursor.pos.x = x;
|
||||||
_cursor.pos.y = y;
|
_cursor.pos.y = y;
|
||||||
_cursor.dirty = true;
|
_cursor.dirty = true;
|
||||||
|
Reference in New Issue
Block a user