Added comment to nk_sdl_handle_grab in SDL demos
Explains call order of SDL_SetRelativeMouseMode and SDL_SetWindowGrab
This commit is contained in:
parent
a10eb1351a
commit
56ab9d96ea
|
@ -240,6 +240,7 @@ nk_sdl_handle_grab(void)
|
|||
if (ctx->input.mouse.grab) {
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
} else if (ctx->input.mouse.ungrab) {
|
||||
/* better support for older SDL by setting mode first; causes an extra mouse motion event */
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
SDL_WarpMouseInWindow(sdl.win, (int)ctx->input.mouse.prev.x, (int)ctx->input.mouse.prev.y);
|
||||
} else if (ctx->input.mouse.grabbed) {
|
||||
|
|
|
@ -349,6 +349,7 @@ nk_sdl_handle_grab(void)
|
|||
if (ctx->input.mouse.grab) {
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
} else if (ctx->input.mouse.ungrab) {
|
||||
/* better support for older SDL by setting mode first; causes an extra mouse motion event */
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
SDL_WarpMouseInWindow(sdl.win, (int)ctx->input.mouse.prev.x, (int)ctx->input.mouse.prev.y);
|
||||
} else if (ctx->input.mouse.grabbed) {
|
||||
|
|
|
@ -349,6 +349,7 @@ nk_sdl_handle_grab(void)
|
|||
if (ctx->input.mouse.grab) {
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
} else if (ctx->input.mouse.ungrab) {
|
||||
/* better support for older SDL by setting mode first; causes an extra mouse motion event */
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
SDL_WarpMouseInWindow(sdl.win, (int)ctx->input.mouse.prev.x, (int)ctx->input.mouse.prev.y);
|
||||
} else if (ctx->input.mouse.grabbed) {
|
||||
|
|
|
@ -271,6 +271,7 @@ nk_sdl_handle_grab(void)
|
|||
if (ctx->input.mouse.grab) {
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
} else if (ctx->input.mouse.ungrab) {
|
||||
/* better support for older SDL by setting mode first; causes an extra mouse motion event */
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
SDL_WarpMouseInWindow(sdl.win, (int)ctx->input.mouse.prev.x, (int)ctx->input.mouse.prev.y);
|
||||
} else if (ctx->input.mouse.grabbed) {
|
||||
|
|
Loading…
Reference in New Issue