Exemple #1
0
int		main(int ac, char **av)
{
  t_data	data;

  set_max_heap_size(30);
  data.sup = bunny_malloc(sizeof(struct s_support));
  if (ac == 2)
    data.sup->name = av[1];
  else
    data.sup->name = NULL;
  data.sup->pos.x = 0;
  data.sup->pos.y = 0;
  if (init_button(&data) == 1)
    return (1);
  init_main_variables(&data);
  init_all_pixarray(&data);
  data.window = bunny_start(WIN_WIDTH, WIN_HEIGHT, 0, "Chroma");
  display_it(&data, data.pixbg, 0, 0);
  display_it(&data, data.pixbgtool, WIN_WIDTH - 255, 150);
  display_it(&data, data.pixbgcalc, WIN_WIDTH - 255, WIN_HEIGHT - 282);
  bunny_set_loop_main_function(mainloop);
  bunny_set_key_response(key_actions);
  bunny_set_click_response(click_actions);
  bunny_loop(data.window, 60, &data);
  bunny_stop(data.window);
  delete_all_clipables(&data);
  empty_list(data.tool, free_calc);
  bunny_free(data.tool);
  return (0);
}
Exemple #2
0
int		main(int ac, char **av, char **env)
{
  t_data	*data;
  int		nb;

  (void) ac;
  (void) av;
#ifdef	DEBUG
  memory_check = 1;
#endif
  if (*env == NULL || (nb = bunny_set_max_ram()) == - 1)
    return (1);
  set_max_heap_size(nb);
  if ((data = my_init_data()) == NULL)
    return (1);
  bunny_set_loop_main_function((t_bunny_loop)mainloop);
  bunny_set_key_response((t_bunny_key)escape);
  bunny_set_move_response((t_bunny_move)move);
  bunny_set_click_response((t_bunny_click)click);
  if (bunny_loop(data->win, 90, data) == EXIT_ON_ERROR)
    return (1);
 #ifdef	DEBUG
  write(1, "STATUS: OK\n", 11);
#endif
  return (0);
}
Exemple #3
0
int			main(int ac, char **av)
{
  t_lapin		*lapin;
  t_bunny_pixelarray 	*tmp;

  set_max_heap_size(30);
  lapin = bunny_malloc(sizeof *lapin);
  if (lapin == NULL)
    return (84);
  lapin->format = parse(ac, av);
  if (lapin->format == 1)
    tmp = load_bitmap(av[1]);
  else if (lapin->format == 2)
    tmp = load_ftn(av[1]);
  if (lapin->format == -1)
    return (1);
  if (lapin->format != -1 && tmp == NULL)
    tmp = NULL;
  lapin->pixelarray_2 = tmp;
  lapin = set_lapin(lapin);
  lapin->str = av[1];
  if (lapin )
    bunny_set_loop_main_function(&refresh_my_game);
  bunny_loop(lapin->window_1, 250, lapin);
  free_all(lapin);
  return (0);
}