#include "textures.h" #define SIZE 100 #define FILENAME_TGA "stripes.tga" int main() { // int mouse = 0; int i; int yellow, black; PALETTE pal; BITMAP *bmp; if(chdir(FILESAVE_PATH) < 0) { perror(FILESAVE_PATH); exit(EXIT_FAILURE); } allegro_init(); install_keyboard(); // install_mouse(); set_color_depth(24); set_gfx_mode(GFX_AUTODETECT, 4 * SIZE, 4 * SIZE, 0, 0); set_close_button_callback(program_close); bmp = create_bitmap(SIZE, SIZE); get_palette(pal); yellow = makecol(255, 255, 50); black = makecol(50, 50, 50); for(i = 0; i < SIZE * SIZE; i++) { int j = i / SIZE; if(((i + j) * 2 / SIZE) % 2) putpixel(bmp, i % SIZE, j, yellow); else putpixel(bmp, i % SIZE, j, black); } save_bitmap(FILENAME_TGA, bmp, pal); stretch_blit(bmp, screen, 0, 0, SIZE, SIZE, 0, 0, SCREEN_W, SCREEN_H); /* for(i = 0; i < 16; i++) { int x, y; x = (i % 4) * SIZE; y = (i / 4) * (SIZE - 1); blit(bmp, screen, 0, 0, x, y, SIZE, SIZE - 1); }*/ destroy_bitmap(bmp); show_mouse(screen); /* while(1) { if(mouse_b & 1) { if(!mouse) { int xpix, ypix; mouse = 1; xpix = 40 * (mouse_x / 40); ypix = 40 * (mouse_y / 40); show_mouse(NULL); if(getpixel(screen, xpix, ypix) == makecol(255, 255, 0)) rectfill(screen, xpix, ypix, xpix + 39, ypix + 39, makecol(0, 0, 0)); else rectfill(screen, xpix, ypix, xpix + 39, ypix + 39, makecol(255, 255, 0)); show_mouse(screen); } } else mouse = 0; if(keypressed()) break; } */ readkey(); return EXIT_SUCCESS; } END_OF_MAIN()