From 1803413b49358e2bbbd27cc65878912cb706b330 Mon Sep 17 00:00:00 2001 From: cutealien Date: Thu, 22 Sep 2022 21:47:19 +0000 Subject: [PATCH] Fix: SDL device can support FPS camera animator again Also no longer restricting mouse position to 0-windowsize (restriction for other devices got removed earlier) And adding some commented out lines to Makesfile for easier testing of SDL. We probably should use some parameter which can be passed to Makefiles for that in the future. Note: This does not fix all cursor troubles for SDL - it still does not support relative rectangle Bit arguably how to handle setting/getting mouse position for SDL, for example it still doesn't support a reference rectangle. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6424 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 1 + examples/02.Quake3Map/Makefile | 1 + examples/09.Meshviewer/Makefile | 1 + source/Irrlicht/CIrrDeviceSDL.h | 11 ++--------- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/changes.txt b/changes.txt index fb7e5979..438cb17b 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,7 @@ -------------------------- Changes in 1.9 (not yet released) +- Fix MouseButtonStates for mouse events in CIrrDeviceSDL when middle or right button are released. - CGUIContextMenu no longer marks EMIE_MOUSE_MOVED as handled - core::array::linear_search and linear_reverse_search can now work with any types as long as corresponding operator== is implemented. - Add checks for sane image sizes in some image loaders (so far: bmp, jpg, tga, png). diff --git a/examples/02.Quake3Map/Makefile b/examples/02.Quake3Map/Makefile index 3ec2e561..e6ab9114 100644 --- a/examples/02.Quake3Map/Makefile +++ b/examples/02.Quake3Map/Makefile @@ -25,6 +25,7 @@ all: all_linux # target specific settings all_linux all_win32 static_win32: LDFLAGS += -L$(IrrlichtHome)/lib/$(SYSTEM) -lIrrlicht all_linux: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lXext -lX11 -lXcursor +#all_linux: LDFLAGS += `sdl-config --libs` all_linux clean_linux: SYSTEM=Linux all_win32 clean_win32 static_win32: SYSTEM=Win32-gcc all_win32 clean_win32 static_win32: SUF=.exe diff --git a/examples/09.Meshviewer/Makefile b/examples/09.Meshviewer/Makefile index 5259d15f..9779a335 100644 --- a/examples/09.Meshviewer/Makefile +++ b/examples/09.Meshviewer/Makefile @@ -25,6 +25,7 @@ all: all_linux # target specific settings all_linux all_win32 static_win32: LDFLAGS += -L$(IrrlichtHome)/lib/$(SYSTEM) -lIrrlicht all_linux: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm -lXext -lX11 -lXcursor +#all_linux: LDFLAGS += `sdl-config --libs` all_linux clean_linux: SYSTEM=Linux all_win32 clean_win32 static_win32: SYSTEM=Win32-gcc all_win32 clean_win32 static_win32: SUF=.exe diff --git a/source/Irrlicht/CIrrDeviceSDL.h b/source/Irrlicht/CIrrDeviceSDL.h index 61a3fd88..06f11f9a 100644 --- a/source/Irrlicht/CIrrDeviceSDL.h +++ b/source/Irrlicht/CIrrDeviceSDL.h @@ -143,6 +143,8 @@ namespace irr virtual void setPosition(s32 x, s32 y) IRR_OVERRIDE { SDL_WarpMouse( x, y ); + CursorPos.X = x; + CursorPos.Y = y; } //! Returns the current position of the mouse cursor. @@ -172,15 +174,6 @@ namespace irr { CursorPos.X = Device->MouseX; CursorPos.Y = Device->MouseY; - - if (CursorPos.X < 0) - CursorPos.X = 0; - if (CursorPos.X > (s32)Device->Width) - CursorPos.X = Device->Width; - if (CursorPos.Y < 0) - CursorPos.Y = 0; - if (CursorPos.Y > (s32)Device->Height) - CursorPos.Y = Device->Height; } CIrrDeviceSDL* Device;