Examples: SDL: Using SDL_WINDOW_INPUT_FOCUS instead of SDL_WINDOW_MOUSE_FOCUS (which is ~~hovered). We should use SDL_CaptureMouse + SDL_WINDOW_MOUSE_CAPTURE_FLAG which requires SDL 2.0.4 will give it a try shortly. (#1559)

This commit is contained in:
omar 2018-01-19 09:25:31 +01:00
parent 74dc70c543
commit ce17e0f274
2 changed files with 2 additions and 2 deletions

View File

@ -274,7 +274,7 @@ void ImGui_ImplSdlGL2_NewFrame(SDL_Window *window)
// (we already got mouse wheel, keyboard keys & characters from SDL_PollEvent()) // (we already got mouse wheel, keyboard keys & characters from SDL_PollEvent())
int mx, my; int mx, my;
Uint32 mouseMask = SDL_GetMouseState(&mx, &my); Uint32 mouseMask = SDL_GetMouseState(&mx, &my);
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_FOCUS) if (SDL_GetWindowFlags(window) & SDL_WINDOW_INPUT_FOCUS)
io.MousePos = ImVec2((float)mx, (float)my); io.MousePos = ImVec2((float)mx, (float)my);
else else
io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX); io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX);

View File

@ -385,7 +385,7 @@ void ImGui_ImplSdlGL3_NewFrame(SDL_Window* window)
// (we already got mouse wheel, keyboard keys & characters from SDL_PollEvent()) // (we already got mouse wheel, keyboard keys & characters from SDL_PollEvent())
int mx, my; int mx, my;
Uint32 mouseMask = SDL_GetMouseState(&mx, &my); Uint32 mouseMask = SDL_GetMouseState(&mx, &my);
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_FOCUS) if (SDL_GetWindowFlags(window) & SDL_WINDOW_INPUT_FOCUS)
io.MousePos = ImVec2((float)mx, (float)my); io.MousePos = ImVec2((float)mx, (float)my);
else else
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX); io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);