#include "Game.h"
#include "SplashState.h"
namespace AFKGames {
Game::Game(int width, int height, std::string title) {
_data->window.create(sf::VideoMode(width, height), title, sf::Style::Default); // <----------------- error occurs
_data->machine.AddState(StateRef(new SplashState(this->_data)));
this->Run();
}
void Game::Run() {
// MainLoop
}
}
Run in Debug-Mode!!
Error Message: Exception thrown at 0x5095FBC6 (sfml-system-d-2.dll) in *.exe: 0xC0000005: Access Violation reading at Location 0xCCCCCCD8.
Any ideas?
Edit:
struct GameData {
StateMachine machine;
sf::RenderWindow window;
AssetManager assets;
InputManager input;
};
typedef std::shared_ptr<GameData> GameDataRef;
class Game {
public:
Game(int width, int height, std::string title);
private:
const float deltaTime = 1.0f / 60;
sf::Clock _clock;
GameDataRef _data = std::make_shared<GameData>(); //<-----------
void Run();
};
User contributions licensed under CC BY-SA 3.0