Skip to content

Commit fccae92

Browse files
committed
sdl3: Update mouse motion to use SDL3's floats
1 parent 95bd684 commit fccae92

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

demo/sdl3/nuklear_sdl3_renderer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,11 @@ nk_sdl_handle_event(struct nk_context* ctx, SDL_Event *evt)
321321
return 1;
322322

323323
case SDL_EVENT_MOUSE_MOTION:
324-
if (ctx->input.mouse.grabbed) {
325-
int x = (int)ctx->input.mouse.prev.x, y = (int)ctx->input.mouse.prev.y;
326-
nk_input_motion(ctx, x + evt->motion.xrel, y + evt->motion.yrel);
327-
}
328-
else nk_input_motion(ctx, evt->motion.x, evt->motion.y);
324+
ctx->input.mouse.prev = ctx->input.mouse.pos;
325+
ctx->input.mouse.delta.x = evt->motion.xrel;
326+
ctx->input.mouse.delta.y = evt->motion.yrel;
327+
ctx->input.mouse.pos.x = evt->motion.x;
328+
ctx->input.mouse.pos.y = evt->motion.y;
329329
return 1;
330330

331331
case SDL_EVENT_TEXT_INPUT:

0 commit comments

Comments
 (0)