From 261bfb611a92c5dec13f65fb225a127a66a1b43b Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sun, 31 Jan 2016 20:59:54 +0800 Subject: Add mouse grabbing. --- smelt/sdl/inp_sdl.cpp | 1 + smelt/sdl/smelt_internal.hpp | 1 + 2 files changed, 2 insertions(+) (limited to 'smelt/sdl') 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); -- cgit v1.2.3