コード例 #1
0
ファイル: cube.c プロジェクト: puyo/tankdemo
int main(void)
{
 allegro_init();
 install_timer();
 install_keyboard();

 rgb_map = malloc(sizeof(RGB_MAP));
 create_rgb_table(rgb_map, desktop_palette, NULL);

 set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);

 buffer = create_bitmap(SCREEN_W, SCREEN_H);
 set_projection_viewport(0, 0, SCREEN_W, SCREEN_H);

 init_shape();

 while (!key[KEY_ESC]) {
   move_shape();
   translate_shape();
   vsync();
   draw();
 }

 destroy_bitmap(buffer);
 free(rgb_map);
 allegro_exit();
 return 0;
}
コード例 #2
0
ファイル: main.c プロジェクト: ajuber/project-Fillit
int		main(int ac, char **av)
{
	int		fd;
	char	**tab;
	int		size;
	t_tetri *tet;

	fd = 0;
	tet = tetri_new('A');
	if (ac != 2)
		print_error();
	fd = open(av[1], O_RDONLY);
	(fd == -1) ? print_error() : 0;
	init_shape(tet, fd);
	if (!file_valide(tet))
		print_error();
	size = ft_sqrt(tetri_count(tet) * 4);
	tab = create_double_tab(size, '.');
	while (fillit(tab, size, tet) == 0)
	{
		free_double_tab(&tab, size);
		size++;
		tab = create_double_tab(size, '.');
	}
	end_fillit(&tab, size, fd, tet);
	return (0);
}
コード例 #3
0
 explicit GridSpec(
     const ndarray<real_t, 2> position,
     const real_t scale) :
     n_dim_  (n_dim),
     scale	(scale),
     box		(init_box(position)),
     shape	(init_shape()),
     zeros   (init_zeros()),
     strides	(init_strides())
 {
 }
コード例 #4
0
ファイル: q27_15.c プロジェクト: k-mi/Stroustrup_PPP
int main(){
	struct Shape s;
	struct Circle c;
	struct Shape* p;
	
	init_shape(&s);
	init_circle(&c);

	draw(&s);
	draw((struct Shape*)&c);

	p = &s;
	draw(p);
	p = (struct Shape*)&c;
	draw(p);
}