0
我的问题是,当我用鼠标滚轮移动视图时,光标精灵 停留在后面,它不会更新到光标本身,我该如何解决这个问题?当我使用鼠标滚轮时如何更新光标?
主游戏循环:
this->cursor->Update(window);
if (event->type == sf::Event::MouseWheelMoved)
{
if (event->mouseWheel.delta == 1)
{
this->view->move(sf::Vector2f(0, -25));
window->setView(*this->view);
event->mouseWheel.delta = 0;
}
else if (event->mouseWheel.delta == -1)
{
this->view->move(sf::Vector2f(0, 25));
window->setView(*this->view);
event->mouseWheel.delta = 0;
}
}
光标更新功能:
this->setPosition(static_cast<sf::Vector2f>(sf::Mouse::getPosition(*window)));
Github上链接: Capitalist Adventure - Project In Question
我的鼠标光标隐藏起来光标精灵看起来像光标,那不是它。 –