Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: 'Unhandled exception at 0x00E884B9 in: 0xC0000005: Access violation'  (Read 1616 times)

0 Members and 1 Guest are viewing this topic.

starrybolt

  • Newbie
  • *
  • Posts: 6
    • View Profile
Hi,

I am currently learning Object Orientated Programming and I am attempting to use an animation class that will be able to be used with every sprite which I will need in my game.

 leftAnimation->setSpriteSheet(playerLeft);

 void Animation::setSpriteSheet(const sf::Texture& texture)
{
    m_texture = &texture;
}
 

The above line of code, throws the unhandled exception error taking me to the setSpritesheet function in the animation class.

In the load content function of the game.cpp this is how the playerLeft texture is loaded in.

 
        if(!playerLeft.loadFromFile("left_spritesheet.png"))
        {
                std::cout << "Could not load texture from file" << std::endl;
        }
 

I am a beginner trying to implement this class (https://github.com/SFML/SFML/wiki/Source:-AnimatedSprite) to make my game object orientated and further understand how it works.

Can anyone please advise?

Many thanks,
starrybolt.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: 'Unhandled exception at 0x00E884B9 in: 0xC0000005: Access violation'
« Reply #1 on: August 07, 2015, 09:03:39 pm »
You need to write a complete and minimal code example for us to help you.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor