Пример #1
0
void	exec_event(t_game_goodies *nfo, t_cfg cfg, t_coord *actual_pos, 
		   t_coord *actual_off, t_trame *trame, t_id_req *id_req,
		   t_game_info_scale *save, t_game_info_scale *select, t_info_scale *sel)
{
  t_coord		tmp[2];
  t_coord		tmp1[2];
  t_coord		click;
  t_game_select_move	dest;
  int			i;
  int			d;
  t_game_info_scale	scale;


  memcpy(nfo->events, trame->msg, trame->len);
  if (nfo->events->mousepose[0].button != 0)
    {
      for (i = 0;  nfo->events->mousepose[i].x != -1 && i != MAXMOUSEEVENT; i++)
	if ((nfo->events->mousepose[i].button == SDL_BUTTON_LEFT ||
	    nfo->events->mousepose[i].button == SDL_BUTTON_RIGHT)
	    && nfo->events->mousepose[i].type == 0)
	  {
	    if (nfo->events->mousepose[i].x >= 5 && nfo->events->mousepose[i].x <= 5 + 96 && 
		nfo->events->mousepose[i].y >= 349 && nfo->events->mousepose[i].y <= 349+96)
	      {
		calc_pos_click(nfo, actual_pos, actual_off, i, id_req);
	      }
	    else
	      {
		calc_selection(nfo, actual_pos, actual_off, i, id_req, sel, select, save);
	      }
	    id_req->info_scale++;
	  }
    }
  else if (get_pos(nfo->events->xfin, nfo->events->yfin, 
		   actual_pos, actual_off, cfg))
    {
      memcpy(&(tmp[0]), actual_pos, sizeof(*actual_pos));
      memcpy(&(tmp[1]), actual_off, sizeof(*actual_off));
      stock_msg(&(cnt->clients[0]), TAG_EDIT_ARENA_SURFACE,
		sizeof(t_coord) * 2, tmp);
    }
  else if (nfo->events->key[0] != 0)
    {
      char	*str;
      
      for (i = 0; i < MAXKEYPRESS; i++)
	if ((str = is_action(nfo->events->key[i])))
	  stock_msg(&cnt->clients[0], TAG_EXECUTION,
		    sizeof(str), (void*)str);
    }
  stock_msg(&cnt->clients[0], TAG_EVENT_OK, 0, NULL);
}
Пример #2
0
bool InputEvent::is_action_released(const StringName &p_action) const {

	return (!is_pressed() && is_action(p_action));
}
Пример #3
0
bool InputEvent::is_action_released(const String& p_action) const {

	return is_action(p_action) && !is_pressed();
}
Пример #4
0
bool InputEvent::is_action_pressed(const StringName &p_action) const {

	return (is_pressed() && !is_echo() && is_action(p_action));
}