Example #1
0
File: main.c Project: plean/CPE
int		main(int ac, char **av)
{
  t_struct	a;

  if (init_tabl(&a))
    return (0);
  a.k = 0;
  a.music = NULL;
  a.back = (ac > 1) ? bunny_load_pixelarray(av[1]) :
      bunny_load_pixelarray("img/carré2.png");
  a.lettre = bunny_load_pixelarray("img/nombres.png");
  if (a.lettre == NULL || a.back == NULL)
    return (0);
  a.square = bunny_new_pixelarray(SQUARE_SIZE, SQUARE_SIZE);
  fox_mod_stretch(a.square, a.back);
  a.nb = bunny_new_pixelarray(SQUARE_SIZE * 9, SQUARE_SIZE);
  fox_mod_stretch(a.nb, a.lettre);
  a.win = bunny_start_style(SQUARE_SIZE * 9 + ECART * 2,
			    SQUARE_SIZE * 9 + ECART * 2,
			    TITLEBAR | CLOSE_BUTTON, "Sudoku");
  a.pix = bunny_new_pixelarray(SQUARE_SIZE * 9 + ECART * 2,
			       SQUARE_SIZE * 9 + ECART * 2);
  destroy_windows(a);
  return (0);
}
Example #2
0
char	alert_box(char *str, t_windows *windows, char type)
{
  t_tektext	_tektext;

  if (NULL == (windows->buffer[2] = bunny_start_style(600, 80,
				     TITLEBAR | CLOSE_BUTTON, "AlertBox")))
    return (0);
  if (NULL == (windows->buff_background[2] = bunny_new_pixelarray(600, 80)))
    return (0);
  fill_buffer(windows->buff_background[2], BLACK);
  _tektext.buff_background = windows->buff_background[2];
  if (type == SUCCESS_ALERT_TYPE)
    _tektext.color = GREEN;
  else if (type == ERROR_ALERT_TYPE)
    _tektext.color = RED;
  else if (type == SUCCESS_ALERT_TYPE)
    _tektext.color = WHITE;
  _tektext.pos.x = 10;
  _tektext.pos.y = 10;
  _tektext.margin[0] = 5;
  _tektext.margin[1] = 5;
  _tektext.text = str;
  _tektext.scale[0] = 2;
  _tektext.scale[1] = 2;
  _tektext.flags = TEKTEXT_X_CENTER | TEKTEXT_Y_CENTER;
  tektext(&_tektext);
}
int			main()
{
  t_bunny_window	*window;

  window = bunny_start_style(800, 600, TITLEBAR | CLOSE_BUTTON, "Ma fenĂȘtre");
  if (!window)
    {
      return (1);
    }
  bunny_display(window);
  sleep(2);
  bunny_stop(window);
  return (0);
}
Example #4
0
char			explorer(t_tekpaint *tekpaint, t_explorer *explorer)
{
  tekpaint->tool.explorer = explorer;
  explorer->current_path = "./";
  explorer->img = NULL;
  explorer->win = bunny_start_style(EXPLORER_WIDTH,
			  EXPLORER_HEIGHT, TITLEBAR | CLOSE_BUTTON,
			  explorer->win_name);
  explorer->buffer = bunny_new_pixelarray(EXPLORER_WIDTH, EXPLORER_HEIGHT);
  if (explorer->buffer == NULL)
    return (0);
  fill_buffer(explorer->buffer, BLACK);
  read_files(explorer);
  display_files(tekpaint, explorer, 0);
  bunny_set_key_response(explorer_on_key);
  bunny_set_click_response(NULL);
  bunny_set_loop_main_function((t_bunny_loop)main_loop_explorer);
  bunny_loop(explorer->win, 50, tekpaint);
  explorer_reset(tekpaint, explorer);
  return (1);
}
Example #5
0
char			open_palette(t_tekpaint *tekpaint)
{
  t_bunny_position	pos;
  t_palette		*palette;

  palette = &tekpaint->tool.palette;
  palette->win = bunny_start_style(PALETTE_WIDTH, PALETTE_HEIGHT,
				   TITLEBAR | CLOSE_BUTTON,
				   "Palette de couleurs");
  if (NULL == (palette->buffer = load_bmp("res/palette.bmp")))
    return (0);
  pos.x = 0;
  pos.y = 0;
  bunny_blit(&palette->win->buffer, &palette->buffer->clipable, &pos);
  bunny_set_click_response(on_palette_event_click);
  bunny_set_loop_main_function((t_bunny_loop)main_loop_palette);
  bunny_loop(palette->win, 50, tekpaint);
  bunny_stop(palette->win);
  palette_reset(palette);
  return (1);
}