【发布时间】:2015-07-13 02:59:08
【问题描述】:
我的问题是当我用鼠标滚轮移动视图时,光标精灵 停留在后面并且不会更新到光标本身,我该如何解决这个问题?
主游戏循环:
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
【问题讨论】:
-
我隐藏了鼠标光标,所以光标精灵看起来像光标所以不是它。
标签: c++ visual-studio visual-c++ sprite sfml