diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-01-31 20:59:54 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-01-31 20:59:54 +0800 |
commit | 261bfb611a92c5dec13f65fb225a127a66a1b43b (patch) | |
tree | e8631a93cc0933a7594327274a1ed47f1de0f4f9 | |
parent | 841465ea45e56bf2f294b5cb934e5ff955c72401 (diff) | |
download | SMELT-261bfb611a92c5dec13f65fb225a127a66a1b43b.tar.xz |
Add mouse grabbing.
-rw-r--r-- | include/smelt.hpp | 1 | ||||
-rw-r--r-- | smelt/sdl/inp_sdl.cpp | 1 | ||||
-rw-r--r-- | smelt/sdl/smelt_internal.hpp | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/include/smelt.hpp b/include/smelt.hpp index bba4ff5..90ffc22 100644 --- a/include/smelt.hpp +++ b/include/smelt.hpp @@ -340,6 +340,7 @@ public: virtual void smGetMouse2f(float *x,float *y)=0; virtual void smSetMouse2f(float x,float y)=0; + virtual void smSetMouseGrab(bool enabled)=0; virtual int smGetWheel()=0; virtual bool smIsMouseOver()=0; virtual int smGetKeyState(int key)=0; diff --git a/smelt/sdl/inp_sdl.cpp b/smelt/sdl/inp_sdl.cpp index c1e05de..d1d335f 100644 --- a/smelt/sdl/inp_sdl.cpp +++ b/smelt/sdl/inp_sdl.cpp @@ -22,6 +22,7 @@ bool SMELT_IMPL::smGetInpEvent(smInpEvent *e) } void SMELT_IMPL::smGetMouse2f(float *x,float *y){*x=posx,*y=posy;} void SMELT_IMPL::smSetMouse2f(float x,float y){SDL_WarpMouseInWindow((SDL_Window*)hwnd,x,y);} +void SMELT_IMPL::smSetMouseGrab(bool enabled){SDL_SetRelativeMouseMode((SDL_bool)(enabled?1:0));} int SMELT_IMPL::smGetWheel(){return posz;} bool SMELT_IMPL::smIsMouseOver(){return mouseOver;} int SMELT_IMPL::smGetKey(){return lkey;} diff --git a/smelt/sdl/smelt_internal.hpp b/smelt/sdl/smelt_internal.hpp index 6d9e04f..b786ee6 100644 --- a/smelt/sdl/smelt_internal.hpp +++ b/smelt/sdl/smelt_internal.hpp @@ -134,6 +134,7 @@ public: virtual void smGetMouse2f(float *x,float *y); virtual void smSetMouse2f(float x,float y); + virtual void smSetMouseGrab(bool enabled); virtual int smGetWheel(); virtual bool smIsMouseOver(); virtual int smGetKeyState(int key); |