Ejemplo n.º 1
0
Archivo: game.c Proyecto: kube/zappy
void				init_game(t_env *e)
{
	t_iterator		iter;
	char			*name;
	t_team			*team;
	int				i;

	e->n_sq = e->opt.height * e->opt.width;
	e->client_lst = ft_lst_new(NULL);
	e->gfx_lst = ft_lst_new(NULL);
	e->team = ft_lst_new(NULL);
	iter = NULL;
	while ((name = (char *)ft_lst_iter_next_content(e->opt.team_name, &iter)))
	{
		team = team_new(name, e->opt.limit);
		i = 0;
		while (i < team->limit)
		{
			ft_lst_pushend(team->unconnected, bot_new(team));
			i++;
		}
		ft_lst_pushend(e->team, team);
	}
	board_create(e);
}
Ejemplo n.º 2
0
GameView* gv_new(SDL_Surface* ecran){
  GameView* test = (GameView*)malloc(sizeof(GameView));
  if(test == NULL){
      return test;
  }

 char *imagePathName = "./assets/gfx/timer.png";

 test->secondsLeft = 120;
 test->timerID = SDL_AddTimer(1000,_timer,test);
 test->infoBGDestination.x = 0;
 test->infoBGDestination.y = 0;
 test->infoBGDestination.w = 600;
 test->infoBGDestination.h = 60;

 test->bgDestination.x = 0;
 test->bgDestination.y = 0;
 //Texte timer
 test->fontColor.r = 255; test->fontColor.g = 255;test->fontColor.b = 255;
 test->pFontSurface = TTF_RenderText_Solid(pFont,"2:00",test->fontColor);
 test->texteDestination.x = 80 - test->pFontSurface->w/2;
 test->texteDestination.y = 15;

 //Chargement de l'image timer
 test->pTimer = IMG_Load(imagePathName);
 if ( test->pTimer == NULL){
    gv_destroy(test);
    return NULL;
 }
 test->timerDestination.x = test->texteDestination.x - 5 - test->pTimer->w;
 test->timerDestination.y = 5;
 test->grille = grille_init(FILE_GRID);
 test->bot = bot_new(test->grille);
 pthread_create(&test->thread,NULL,bot_execute,(void*)test->bot);
 return test;
}