1
Graphics / exception thrown issues
« on: June 26, 2020, 09:40:21 pm »
I was creating this game that requires to control multiple sprite movement, so I created an array player class(Player* player[10]. I write all of the renders and updates and I got thrown an exception in the line:
target.draw(this->sprite);
in my render function inside the Player class
void Player::render(RenderTarget& target)
{
target.draw(this->sprite);
}
in the game.cpp:
for (int i = 0; i <= c; i++ )//c is the amount of players
{
this->player->render(*this->window);
}
this is the exception:
Unhandled exception at 0x7B81CF29 (sfml-graphics-d-2.dll) in sim.exe: 0xC0000005: Access violation reading location 0x00000008.
and it can't run.
if i comment that line only(target.draw(this->sprite) it runs as normal but when closed it throws another exception:
sim.exe has triggered a breakpoint
before this happened I didn't make the player class an array and it ran smoothly but tbh I don't know if it will run correctly or not. it has no errors detected and it confuses me how to stop it from running after the exception is thrown(both exceptions).
ps. sorry I didn't post any image I still don't know how
target.draw(this->sprite);
in my render function inside the Player class
void Player::render(RenderTarget& target)
{
target.draw(this->sprite);
}
in the game.cpp:
for (int i = 0; i <= c; i++ )//c is the amount of players
{
this->player->render(*this->window);
}
this is the exception:
Unhandled exception at 0x7B81CF29 (sfml-graphics-d-2.dll) in sim.exe: 0xC0000005: Access violation reading location 0x00000008.
and it can't run.
if i comment that line only(target.draw(this->sprite) it runs as normal but when closed it throws another exception:
sim.exe has triggered a breakpoint
before this happened I didn't make the player class an array and it ran smoothly but tbh I don't know if it will run correctly or not. it has no errors detected and it confuses me how to stop it from running after the exception is thrown(both exceptions).
ps. sorry I didn't post any image I still don't know how