From d606930d4f002344769e59c361e638a83579a90b Mon Sep 17 00:00:00 2001 From: matthew Date: Sat, 3 Nov 2018 21:38:17 +0000 Subject: [PATCH] added SDL_SetRelativeMouseMode --- gl/input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gl/input.c b/gl/input.c index c8a3575..e1d7111 100644 --- a/gl/input.c +++ b/gl/input.c @@ -88,9 +88,12 @@ void crpgInputInit() kb.binds = malloc(sizeof(Uint8) * INPUT_LAST); loadKeybinds(); - // Init the last frame array to 0 memset(kb.prevState, 0, sizeof(Uint8)*SDL_NUM_SCANCODES); memcpy(kb.state, SDL_GetKeyboardState(NULL), sizeof(Uint8)*SDL_NUM_SCANCODES); + + // constraining the mouse to the window + // TODO: only set relative mouse mode once the mouse is in the window, disable input otherwise + SDL_SetRelativeMouseMode(SDL_TRUE); } void crpgInputCleanup() -- 2.20.1