Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. int Gameloop(IGUI *GUI, IGame *GAME)
  2. {
  3. Game::Command dir;
  4. Game::s_game *t_Game;
  5. Game::s_board_info *info;
  6.  
  7. info = GAME->GET_Board_info();
  8. GUI->Init_Game(info->height, info->width);
  9. dir = Game::Command::NONE;
  10. while (GAME->CYCLE(dir) != -1)
  11. {
  12. GUI->Keyboard();
  13. dir = GUI->GET_key();
  14. t_Game = GAME->GET_core_game();
  15. GAME->DISPLAY(GUI);
  16. usleep(t_Game->speed);
  17. }
  18. GUI->Clear_WIN();
  19. }
  20.  
  21. int main(int ac, char **av)
  22. {
  23. IGame *GAME = NULL;
  24. IGUI *GUI;
  25.  
  26. std::string path = "Games/";
  27.  
  28. GUI = load_library(av[1]);
  29. if (GUI == NULL)
  30. return (-1);
  31.  
  32. std::vector<t_directory> v = Game_Finder(path);
  33. while (1)
  34. {
  35. GUI->Init_GUI();
  36. std::string str = GUI->Launcher(v);
  37. if (str.empty())
  38. {
  39. Error(GUI, GAME);
  40. return (-1);
  41. }
  42. GAME = load_game(path + str);
  43. if (GAME == NULL)
  44. {
  45. Error(GUI, GAME);
  46. return (-1);
  47. }
  48. Gameloop(GUI, GAME);
  49. }
  50. delete GUI;
  51. delete GAME;
  52. return (0);
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement