So I was, in another thread told to update my SFML to the source version. Upon doing so it fixed my problem, but now most of my classes that use SFML are broken. Here is one of the classes that is not working, I'm getting an
Unhandled exception at 0x00000000 in SFML2D.exe: 0xC0000005: Access violation reading location 0x00000000.
on the
window.draw(m_Sprite);
Here is the section containing the code:
case Animation::FadeIn:
m_Alpha = 0;
m_Sprite.setColor(sf::Color(255, 255, 255, m_Alpha));
while (isAnimating)
{
window.clear();
window.draw(m_Sprite);
window.display();
if (loopIndex == 1)
{
if (m_Clock.getElapsedTime() > sf::seconds(m_InitTime))
{
++i;
m_Sprite.setColor(sf::Color(255, 255, 255, m_Alpha));
window.draw(m_Sprite);
++loopIndex;
!isAnimating;
return;
}
}
else if (loopIndex == 0)
{
if (m_Clock.getElapsedTime() > sf::milliseconds(i*m_Time))
{
++i;
m_Sprite.setColor(sf::Color(255, 255, 255, m_Alpha));
window.draw(m_Sprite);
++m_Alpha;
if (m_Alpha > 255)
{
++loopIndex;
}
}
}
}
break;
and this following part is my constructor (I do have a default constructor, but it does nothing and requires a create() or setSomeAttr() call, which basicly does what the following constructor does.):
Splash::Splash(sf::Texture Texture, int InitTime, int Time)
{
m_Texture = Texture;
m_Sprite.setTexture(m_Texture);
m_InitTime = InitTime;
m_Time = Time;
}
EDIT::
I didn't change anything, but it seems that the problem is now the
virtual void draw(sf::RenderTarget &target, sf::RenderStates states) const
function, that makes something drawable in sfml. This is the only line I have in there:
target.draw(m_Sprite, states);
Helpful Info:
- OS: Windows XP 32-bit
- Compiler: Visual C++ 2010 Express
- SFML Version: Built from latest source as of December 9th.
- SFML Link Type: Dynamic