我正在尝试使用allegro 4创建一个程序来加载一些用于创建空间入侵者用户界面的图像。
#include <allegro.h>
int main(void)
{
char *filename = "ship.gif";
BITMAP *image;
int ret;
allegro_init();
install_keyboard();
set_color_depth(16);
ret = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
if (ret != 0) {
allegro_message(allegro_error);
return 1;
}
//load the image file
image = load_bitmap(filename, NULL);
if (!image) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("Error loading %s", filename);
return 1;
}
//display the image
blit(image, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
//done drawing--delete bitmap from memory
destroy_bitmap(image);
//display video mode information
textprintf_ex(screen,font,0,0,1,-1,"%dx%d",SCREEN_W,SCREEN_H);
while (!keypressed());
//exit program
allegro_exit();
return 0;
}
END_OF_MAIN()
这是我的代码,我正在尝试加载一些图像以形成空间入侵者用户界面..当我运行它时,它显示 错误加载ship.gif ..任何人都可以帮忙吗?