Hi guys, I'm just started working on a new project of mine. I just finished the game loop and everything seemed fine but the window rendered by SFML is not responding and when I hover my mouse over it the cursor will change to a loading symbol. I added some console messages and the loop is still running.
void update_game(sf::RenderWindow& window)
{
std::cout << "update";
window.clear();
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
window.draw(shape);
}
void display_game(sf::RenderWindow& window, float interpolation)
{
std::cout << "display";
window.display();
}
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
const int TICKS_PER_SECOND = 25;
const int SKIP_TICKS = 1000 / TICKS_PER_SECOND;
const int MAX_FRAMESKIP = 5;
DWORD next_game_tick = GetTickCount();
int loops;
float interpolation;
//bool game_is_running = true;
while(window.isOpen())
{
loops = 0;
while( GetTickCount() > next_game_tick && loops < MAX_FRAMESKIP)
{
std::cout << "tickloop";
update_game(window);
next_game_tick += SKIP_TICKS;
loops++;
}
interpolation = float( GetTickCount() + SKIP_TICKS - next_game_tick )
/ float( SKIP_TICKS );
display_game(window, interpolation);
}
return 0;
}