1
Graphics / Seems like draw function is crashing my program
« on: November 03, 2017, 04:37:11 pm »void DrawingNumbers::Animation(sf::RenderWindow &m_window)
{
m_possibleNum.resize(48);
int j = 1;
for(int i = 0; i < 48; i++)
{
m_possibleNum[i] = j;
j++;
}
std::random_shuffle(m_possibleNum.begin(), m_possibleNum.end());
// loading texture to sprite
for(int i = 0; i < 35; i++)
{
m_drawnNumber[i].setTexture(m_tx[m_possibleNum[i]]);
m_drawnNumber[i].setScale(sf::Vector2f(0.120f, 0.120f));
}
// drawing
for(int i = 0; i < 35; i++)
{
m_window.draw(m_drawnNumber[i]);
}
}
{
m_possibleNum.resize(48);
int j = 1;
for(int i = 0; i < 48; i++)
{
m_possibleNum[i] = j;
j++;
}
std::random_shuffle(m_possibleNum.begin(), m_possibleNum.end());
// loading texture to sprite
for(int i = 0; i < 35; i++)
{
m_drawnNumber[i].setTexture(m_tx[m_possibleNum[i]]);
m_drawnNumber[i].setScale(sf::Vector2f(0.120f, 0.120f));
}
// drawing
for(int i = 0; i < 35; i++)
{
m_window.draw(m_drawnNumber[i]);
}
}
m_drawnNumber is an array
m_possibleNum is a vector
I call this function in main and my program runs (white screen) and breaks with "Process returned -1073741819 (0xC0000005)".
I ran a debugger and these errors popped up https://imgur.com/a/oxYWs
(Izvlacenje::Animacija = DrawingNumbers::Animation) I translated it to English, so you can understand.