aboutsummaryrefslogtreecommitdiff
path: root/smelt
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-01-31 20:59:54 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-01-31 20:59:54 +0800
commit261bfb611a92c5dec13f65fb225a127a66a1b43b (patch)
treee8631a93cc0933a7594327274a1ed47f1de0f4f9 /smelt
parent841465ea45e56bf2f294b5cb934e5ff955c72401 (diff)
downloadSMELT-261bfb611a92c5dec13f65fb225a127a66a1b43b.tar.xz
Add mouse grabbing.
Diffstat (limited to 'smelt')
-rw-r--r--smelt/sdl/inp_sdl.cpp1
-rw-r--r--smelt/sdl/smelt_internal.hpp1
2 files changed, 2 insertions, 0 deletions
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);