mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-06 06:34:35 +00:00
Handle global mouse state for Emscripten (#12669)
This commit is contained in:
parent
53d053279e
commit
cc8ec6cf18
2 changed files with 66 additions and 0 deletions
|
|
@ -117,6 +117,8 @@ static void loop(void *arg)
|
|||
struct mouse_loop_data *loop_data = (struct mouse_loop_data *)arg;
|
||||
SDL_Event event;
|
||||
SDL_Renderer *renderer = loop_data->renderer;
|
||||
float fx, fy;
|
||||
SDL_MouseButtonFlags flags;
|
||||
|
||||
/* Check for events */
|
||||
while (SDL_PollEvent(&event)) {
|
||||
|
|
@ -265,6 +267,10 @@ static void loop(void *arg)
|
|||
DrawObject(renderer, active);
|
||||
}
|
||||
|
||||
flags = SDL_GetGlobalMouseState(&fx, &fy);
|
||||
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
|
||||
SDL_RenderDebugTextFormat(renderer, 0, 0, "Global Mouse State: x=%f y=%f flags=%" SDL_PRIu32, fx, fy, flags);
|
||||
|
||||
SDL_RenderPresent(renderer);
|
||||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue