int main() { srand (time (0)); sf::RenderWindow window (sf::VideoMode(480*0.5, 800*0.5), "Fighters"); window.setFramerateLimit(60); PASS = 1; Things::load (); Sound::load (); Text::load (); Sky sky; Hero hero; Sound::GAME_MUSIC.play (); while (window.isOpen()) { // check all the window's events that were triggered since the last iteration of the loop sf::Event event; while (window.pollEvent(event)) { // "close requested" event: we close the window if (event.type == sf::Event::Closed) window.close(); } // clear the window with black color window.clear( sf::Color::Black ); int test = 0; if ( hero.getRed() < -1 ) test = 1; switch ( test ) { case 1: sky.gameover ( window ); Sound::GAME_MUSIC.play (); break; case 0: if ( hero.getRed() > 0 ) { Game ( hero ); if ( timeNow > TIME-PASS*10 ) { timeNow = 0; sky.addEnemy ( enemy, PASS); } timeNow++; gapNow++; sky.heroGunRunInto ( hero, enemy ); } hero.gunMove (); sky.draw ( window, hero ); drawEnemy ( window ); break; } levelUp (); Text::outText ( window, hero.getRed(), PASS ); // end the current frame window.display(); } return 0; }