Ok here is main function:
int main()
{
if (!sf::Shader::isAvailable())
{
return -1;
}
try
{
Game game;
game.Run();
}
catch (std::exception& e)
{
std::cout << e.what() << std::endl;
std::cin.get();
}
}
Here is constructor for Game class, thats where the window is created:
Game::Game() : window(sf::VideoMode(800, 600), "sfml-app", 7U, sf::ContextSettings(0U, 0U, 10U)), postShader(NULL) //Here window is created, i tried other methods but still crashing
{
defaultFont.loadFromFile("AllOverAgain.ttf");
frameTime = 0;
}
Here is the Game::Run function (thats whre the crash happens):
void Game::Run()
{
while(window.isOpen())
{
timer.restart();
sf::Event event;
while(window.pollEvent(event)) //here crash
{
stateManager.HandleEvent(event);
if (event.type == sf::Event::Closed)
{
window.close();
}
}
/*
// Update
stateManager.Update(frameTime);
window.clear();
stateManager.Draw();
window.display();
*/
frameTime = timer.getElapsedTime().asSeconds();
if (frameTime > 0.1)
{
frameTime = 0.1;
}
}
}
Anyway I am curious as of why you are using a unsigned int and not the enums SFML provides for style?
They caused some errors about too many arguments or smth