Hello Everyone,
So I seem to be having an issue with my Mouse Scroll Wheel Event in SFML version 1.6. I am using the static libraries, in the C++ language.
In my debug version, the scroll event fires as would be completely expected. When one would move the scroll wheel up or down it fires an event corresponding to the movement. However when I build a release version, it does not work as expected, and I'm not exactly sure why.
Here's the problem: When I move my scroll wheel in the release build, there is NO event fired, until I left or right click. Now I did not write my code to do this, so it's completely unexpected. And the issue is not prevalent in the Debug Version, so I assume it's a linker problem.
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
std::cout << totalMenus << ", " << rMenus[0].GetTotalItems() << ", " << rMenus[1].GetTotalItems() << ", " << rMenus[2].GetTotalItems() << ", " << delay << ", " << menu << std::endl;
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
// Escape key : exit
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
// If we moved the wheel within the delay.
if ((Event.Type == sf::Event::MouseWheelMoved) && delay == 0)
{
std::cout << menu << ": " << rMenus[menu].GetSelectedIndex() << std::endl;
// Setup the delta. (Only needed for positive/negative)
bool delta = Event.MouseWheel.Delta > 0 ? true : false;
// Check what menu we are in.
if (menu == -1)
{
// No menu. Join the main menu.
menu = 0;
}
else
{
rMenus[menu].MouseScroll(delta);
}
// Setup the delay so that it slows how many scrolls per second.
delay = 4;
}
if (Event.Type == sf::Event::MouseButtonPressed && delay == 0)
{
// Check what button was clicked.
if (Event.MouseButton.Button == sf::Mouse::Button::Right)
{
if (menu > -1)
{
menu = rMenus[menu].UnSelect();
rMenus[menu].UnSelect();
}
}
else if (Event.MouseButton.Button == sf::Mouse::Button::Left)
{
if (menu > -1)
{
menu = rMenus[menu].Select();
}
}
// Setup the delay so nothing is processed too quickly.
delay = 4;
}
if (Event.Type == sf::Event::Resized)
{
WindowView = sf::View(sf::FloatRect(0, 0, Event.Size.Width, Event.Size.Height));
rMenus[0].SetView(Event.Size.Width, Event.Size.Height);
rMenus[1].SetView(Event.Size.Width, Event.Size.Height);
rMenus[2].SetView(Event.Size.Width, Event.Size.Height);
sprites[0].SetPosition(Event.Size.Width / 2 + 16, Event.Size.Height / 2 + 16);
sprites[1].SetPosition(Event.Size.Width / 2 + 16, Event.Size.Height / 2 + 16);
}
}
// Decrement the Delay as needed.
if (delay > 0)
delay--;
The above is my event handler code. I am using Microsoft Visual Studio 2010 Ultimate, and yes, I did rebuild the SFML libraries in Visual Studio 2010 Ultimate.
If anyone has any ideas about what would cause this, and how I could possibly resolve this, I would be greatly obliged.
Edit: Forgot to mention, when I run my release build in the debugger it works as expected, it's only when run outside Visual Studio 2010 Ultimate that it fails, and fairly miserably I might add.
Thanks,
EBrown8534