Exemplo n.º 1
0
void			line_ended(t_mlx *init, t_cod *cor)
{
  if (FRAME_PER_PIX > 2 || cor->y % 120 == 0)
    gere_expose(init);
  cor->x = 0;
  cor->y = cor->y + 1;
}
Exemplo n.º 2
0
int		fill_img(t_mlx *win, t_elem *elem)
{
  int		y;
  int		x;

  y = 0;
  while (y < WIN_Y)
    {
      x = 0;
      while (x < WIN_X)
  	{
	  win->eye_t.x = 100;
	  win->eye_t.y = ((WIN_X / 2) - x);
	  win->eye_t.z = ((WIN_Y / 2) - y);
	  win->V_eye.x = (win->eye_t.x - win->eye.x);
	  win->V_eye.y = (win->eye_t.y - win->eye.y);
	  win->V_eye.z = (win->eye_t.z - win->eye.z);
  	  calc_items(win, &elem);
  	  ppti(win, x, y, draw_objs(win, elem));
  	  ++x;
  	}
      gere_expose(win);
      ++y;
    }
  return (1);
}
Exemplo n.º 3
0
t_fen		*new_fen_save(t_all *param, t_savewin *info)
{
  t_fen		*result;

  del_all_fen(param->fen, param);
  result = malloc(sizeof(*result));
  result->background = get_fenbackground(param, 600, 400);
  result->background_r = get_fenbackground_r(param, 600, 400);
  result->pos_x = (WIN_X / 2) - (600 / 2);
  result->pos_y = (WIN_Y / 2) - (400 / 2);
  result->cur_pos_x = -1;
  result->cur_pos_y = -1;
  result->type = FENTYPE_SAVE;
  result->size_x = 600;
  result->size_y = 400;
  result->next = NULL;
  result->prev = NULL;
  result->on_quit = NULL;
  result->param = info;
  param->fen = result;
  getcwd(((t_savewin *)(result->param))->old_pwd, 1023);
  save_fen_lineedit(result, 50, 370);
  save_fen_navigateur(result);
  gere_expose(param);
  return (result);
}
Exemplo n.º 4
0
int	gere_key(int keycode, t_img *img)
{
  if (keycode == 65307)
    {
      my_putstr("Echap !\n");
      exit(0);
    }
  else if (keycode == 65362)
    {
      gere_expose(img);
    }
  else if (keycode == 65364)
    {
      gere_expose(img);
    }
  return (0);
}
Exemplo n.º 5
0
void			post_work(t_mlx *init, t_cod *cor, int *pass)
{
  *pass = *pass + 1;
  my_putstr("Pass ");
  my_put_nbr(*pass);
  my_putstr(" finished\n");
  gere_expose(init);
  cor->x = 0;
  cor->y = 0;
}
Exemplo n.º 6
0
int		gere_key(int keycode, t_all *str_all)
{
  t_fen		*last;

  last = str_all->fen;
  if (keycode == XK_Escape)
    {
      if (!last)
	signal_quit(str_all, NULL);
      while (last->next)
	last = last->next;
      if (last->prev)
	last->prev->next = NULL;
      else
	str_all->fen = NULL;
      del_fen(last, str_all);
      gere_expose(str_all);
    }
  else if (str_all->fen && str_all->fen->type == FENTYPE_SAVE)
    key_fensave(str_all, keycode);
  else if (keycode == XK_s)
    str_all->fen = new_fen_save(str_all, get_winsave_param(str_all));
  return (0);
}
Exemplo n.º 7
0
int		key_fensave(t_all *str_all, int key)
{
  t_savewin	*sf;

  sf = str_all->fen->param;
  if ((key >= XK_0 && key <= XK_z) || key == XK_period)
    {
      if (my_strlen(sf->filename) <= 64)
	{
	  sf->filename[my_strlen(sf->filename) + 1] = '\0';
	  sf->filename[my_strlen(sf->filename)] = (key == XK_period) ?
	    '.' : key - XK_a + 'a';
	}
    }
  else if (key == XK_BackSpace)
    sf->filename[(my_strlen(sf->filename) > 0) ?
		 my_strlen(sf->filename) - 1: 0] = '\0';
  else if (key == XK_Return)
    save(str_all, sf->old_pwd, sf->filename);
  else
    return (0);
  gere_expose(str_all);
  return (0);
}