?? main.c
字號:
//This code demonstrated the cabilites of the LZW code and gif loader
//The GIF code and this demo requires Allegro to Compile and run
//The LZW code does not.
#include <stdio.h>
#include "allegro.h"
#include "lzw.h"
#include "gif.h"
int main(int argc, char *argv[])
{
LZW mytable;
BITMAP *btest;
PALETTE pal;
if (allegro_init())
{ allegro_message("Cannot Initialize Allegro.\n");
return 1;
}
if (install_keyboard())
{ allegro_message("Cannot Initialize Keyboard.\n");
return 1;
}
if(install_timer())
{ allegro_message("Cannot Initialize Timer \n.");
return 1;
}
if (install_mouse()<0)
{ allegro_message("Cannot Initialize Mouse.\n");
return 1;
}
//Set Graphics Mode
set_color_depth(16); //Make 256 Colours
if(set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,400,0,0))
{ allegro_message("Cannot Initialize Screen.\n");
return 1;
}
set_color_conversion(COLORCONV_TOTAL);
//Compress
create_lzw_table(&mytable,12);
//Here we create a compressed copy of sample
lzw_compress_file(&mytable,"test.txt","utest.txt");
//And we create an uncompressed copy for comparison
lzw_decompress_file(&mytable,"utest.txt", "untest.txt");
//Now we load a gif using our loader
//And display it
btest = load_gif("test.gif",pal);
select_palette(pal);
draw_sprite(screen, btest, 0,0);
destroy_bitmap(btest);
rest(2000);//Give the user time to see the image
return 0;
}
END_OF_MAIN()
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -