fix mouse delta not reseting to zero
This commit is contained in:
parent
477ab44e8c
commit
f74e9dfdb4
@ -31,14 +31,16 @@ void Input::updateEvents(){
|
|||||||
m_closeRequested = false;
|
m_closeRequested = false;
|
||||||
m_hasBeenResized = false;
|
m_hasBeenResized = false;
|
||||||
m_delta_vertical_scroll = 0;
|
m_delta_vertical_scroll = 0;
|
||||||
|
m_last_mouse_position = m_mouse_position;
|
||||||
|
|
||||||
/* global affectation */
|
/* global affectation */
|
||||||
kb = m_keybindings[m_current_context];
|
kb = m_keybindings[m_current_context];
|
||||||
m_actions.clear();
|
m_actions.clear();
|
||||||
|
|
||||||
/* event-parsing loop */
|
/* event-parsing loop */
|
||||||
while(m_window->pollEvent(event)){
|
while(m_window->pollEvent(event))
|
||||||
// std::cout << event.type << std::endl;
|
{
|
||||||
|
// std::cout << event.type << std::endl;
|
||||||
switch(event.type){
|
switch(event.type){
|
||||||
case sf::Event::Closed:
|
case sf::Event::Closed:
|
||||||
m_closeRequested = true;
|
m_closeRequested = true;
|
||||||
@ -68,7 +70,6 @@ void Input::updateEvents(){
|
|||||||
m_delta_vertical_scroll = event.mouseWheelScroll.delta;
|
m_delta_vertical_scroll = event.mouseWheelScroll.delta;
|
||||||
break;
|
break;
|
||||||
case sf::Event::MouseMoved:
|
case sf::Event::MouseMoved:
|
||||||
m_last_mouse_position = m_mouse_position;
|
|
||||||
m_mouse_position = sf::Mouse::getPosition();
|
m_mouse_position = sf::Mouse::getPosition();
|
||||||
break;
|
break;
|
||||||
case sf::Event::MouseEntered:
|
case sf::Event::MouseEntered:
|
||||||
@ -82,18 +83,17 @@ void Input::updateEvents(){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto key: m_heldkeys){
|
for (auto key: m_heldkeys)
|
||||||
|
{
|
||||||
m_actions.push_back(kb.getHoldAction(key));
|
m_actions.push_back(kb.getHoldAction(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<int> Input::getActions()
|
std::vector<int> Input::getActions()
|
||||||
{
|
{
|
||||||
return m_actions;
|
return m_actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* context-related functions */
|
/* context-related functions */
|
||||||
void Input::addContext(Context context)
|
void Input::addContext(Context context)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user