[ create a new paste ] login | about

Link: http://codepad.org/RtqHnw2K    [ raw code | fork ]

C++, pasted on Dec 13:
int main(int argc, char *argv[])
{
  std::cout << "START!" << std::endl;
  if (argc==2 && (std::string(argv[1])=="--help"||std::string(argv[1])=="-h"))
    {
      usage();
    }
  std::string fontfile = "FreeSans.ttf";
  if (argc==3 && std::string(argv[1])=="-font")
    {
      fontfile = argv[2];
      std::cout << "FontFile: " << fontfile << std::endl;
    }
  std::ifstream file_exists(fontfile.c_str());
  if (!(file_exists.good())) {
    std::cout << "Fontfile '" << fontfile << "' does not exists!" << std::endl;
    usage();
  }


  srand(time(NULL));
  int screen_x = 800;
  int screen_y = 600;
  Env e;
  Game g(e);
  g.init_window();
  g.init();
  bool exit1 = false;
  for(int i=0;i<8;i++)
    {
      g.init_level(i);
      while(1) {
	SDL_Delay(10);
	bool b1 = g.step(); // next level if b1==false
	bool b2= g.event_handling();
	if (!b1) break;
	if (!b2) {exit1=true; break; }
      }
      if (exit1==true) break;
    }
  exit(0);
  return 0;
}


Create a new paste based on this one


Comments: