From: matthew Date: Sat, 3 Nov 2018 21:38:17 +0000 (+0000) Subject: added SDL_SetRelativeMouseMode X-Git-Url: https://git.owens.tech///git?a=commitdiff_plain;h=d606930d4f002344769e59c361e638a83579a90b;p=csrpg.git added SDL_SetRelativeMouseMode --- 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()