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