コード例 #1
0
ファイル: Tetris_main.c プロジェクト: rayalex/mikro-Blocks
void main()
{
    Start_TP();
    Initialize_Game();

    while (1)
    {
        Check_TP();
        Update_Game();
    }
}
コード例 #2
0
ファイル: game.cpp プロジェクト: jchuong/heliassault
int main(void)
{
  sf::RenderWindow window(sf::VideoMode(ORIGINAL_WIDTH, ORIGINAL_HEIGHT), "Heli-Assault");
  window.setFramerateLimit(120);
  Initialize_Game();
  while (window.isOpen())
  {
    Create_Building();
    Move_Buildings();
    sf::Event event;
    while (window.pollEvent(event))
    {
      if (event.type == sf::Event::Closed)
      {
        window.close();
      }

      // Handle key input here
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
      {
        Player->Move_Left();
      }
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
      {
        Player->Move_Right();
      }
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
      {
        Player->Move_Up();
      }
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
      {
        Player->Move_Down();
      }
      if (sf::Keyboard::isKeyPressed(sf::Keyboard::Space))
      {
        Player->Shoot();
      }
    }
    window.clear();
    Draw_Background(window);
    Draw_Buildings(window);
    Draw_Player(window);
    window.display();
  }
  return 0;
}