This is the weirdest bug I've ever seen...
Some code:
void Graph::update(SceneData dimens) {
for (int x = 0; x <= dimens.screenWidth; x++) {
points[x].position = sf::Vector2f( x, (dimens.xLow+(x*dimens.step)));
points[x].color = sf::Color::Black;
}
}
and
Graph graph;
graph.update(dimens);
while (window.isOpen()){
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::White);
window.draw(xAxis);
window.draw(yAxis);
window.draw(graph.points);
window.display();
}
return 0;
}
So when I run this, the graph draw fine and stays on the screen. However, if I move my mouse for more than a second it crashes. This does NOT happen when I run it using the CodeBlocks debugger, so the only info I have about the crash is from the Windows crash dialog, which says its in ntdll.dll. It also does not happen if I comment out
points[x].color = sf::Color::Black;
I have no idea what moving the mouse and setting the color have to do with each other, so...yeah.
Any ideas?