Examples: SDL: Fixed compilation for SDL 2..0.3 and less (running on our test servers) and clarified a bit of the messy situation. Followup to 8dd83c5. (#1542, #2117)
Uint32mouse_buttons=SDL_GetMouseState(&mouse_x,&mouse_y);// NB: We don't use the x/y results from SDL_GetMouseState()
SDL_GetGlobalMouseState(&mouse_x,&mouse_y);
io.MouseDown[0]=g_MousePressed[0]||(mouse_buttons&SDL_BUTTON(SDL_BUTTON_LEFT))!=0;// If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
// [2]
// Set Dear ImGui mouse pos from OS mouse pos + get buttons. (this is the common behavior)
io.MouseDown[0]=g_MousePressed[0]||(mouse_buttons&SDL_BUTTON(SDL_BUTTON_LEFT))!=0;// If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
// Singleviewport mode: mouse position in client window coordinates (io.MousePos is (0,0) when the mouse is on the upper-left corner of the app window)
// Single-viewport mode: mouse position in client window coordinatesio.MousePos is (0,0) when the mouse is on the upper-left corner of the app window)
// We already retrieve global mouse position, SDL_CaptureMouse() also let the OS know e.g. that our imgui drag outside the SDL window boundaries shouldn't trigger the OS window resize cursor
// SDL_CaptureMouse() will let the OS know that our drag outside the SDL window boundaries shouldn't trigger the OS window resize cursor.
// The function is only supported from SDL 2.0.4 (released Jan 2016)