Skip to content

Commit 49bae74

Browse files
committed
set mouse_rel()
1 parent 187319e commit 49bae74

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Qor/Input.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,17 @@ void Controller :: rumble(float magnitude, Freq::Time t)
491491
//SDL_HapticRumblePlay(m_pHaptic, magnitude, t.ms());
492492
}
493493

494+
void Input :: mouse_rel(glm::vec2 mp) const
495+
{
496+
int x,y;
497+
SDL_GetGlobalMouseState(&x,&y);
498+
mouse_pos(glm::vec2(mp.x + x, mp.y + y));
499+
}
500+
494501
void Input :: mouse_pos(glm::vec2 mp) const
495502
{
496-
SDL_WarpMouseInWindow(
497-
m_pWindow->sdl_window(),
503+
SDL_WarpMouseGlobal(
504+
//m_pWindow->sdl_window(),
498505
std::max(0.0f, mp.x), glm::max(0.0f, mp.y)
499506
);
500507
}

Qor/Input.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ class Input:
405405
return m_MousePos;
406406
}
407407
void mouse_pos(glm::vec2 mp) const;
408+
void mouse_rel(glm::vec2 mp) const;
408409

409410
void relative_mouse(bool b) {
410411
if(b != m_bRelMouse) {

0 commit comments

Comments
 (0)