Imported contents: kraptor_final_apr_03_2004.tar.gz
[kraptor.git] / extras / mapedit / makegrid.c
blob82fcb275c04132b4b0bd1b08e4f25e12ceec306e
1 /*
2 Este programa fabrica la grilla en un bmp
3 */
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <allegro.h>
9 /* Tama¤o del fondo */
10 #define W_FONDO 600
11 #define H_FONDO 4000
13 /* Grilla WxH */
14 #define W_GR 40
15 #define H_GR 40
18 int main() {
19 BITMAP *bmp;
20 PALETTE pal;
21 int iy, ix;
23 int card = GFX_AUTODETECT, w = 640 ,h = 480 ,color_depth = 8; /* agregado por Kronoman */
25 allegro_init();
26 install_timer();
27 install_keyboard();
28 install_mouse();
30 set_color_depth(color_depth);
31 if (set_gfx_mode(card, w, h, 0, 0)) {
32 allegro_message("set_gfx_mode(%d x %d x %d bpp): %s\n", w,h, color_depth, allegro_error);
33 return 1;
36 set_palette(default_palette);
37 clear(screen);
39 get_palette(pal);
40 bmp = create_bitmap(W_FONDO, H_FONDO);
41 clear(bmp);
43 for (ix=0; ix < W_FONDO / W_GR; ix ++ )
44 line(bmp, ix*W_GR, 0, ix*W_GR, H_FONDO, makecol(255,255,255));
46 for (iy=0; iy < H_FONDO / H_GR; iy ++ )
47 line(bmp, 0, iy*H_GR, W_FONDO, iy*H_GR, makecol(255,255,255));
50 save_bitmap("grilla.pcx", bmp, pal);
51 destroy_bitmap(bmp);
53 return 0;
55 END_OF_MAIN();