【发布时间】:2017-07-29 10:56:41
【问题描述】:
我正在使用 allegro 库开发游戏。我写了一个起始 C 代码然后我在 Ubuntu 终端上编译程序。之后当我打开输出程序时,程序打开但没有关闭。取消按钮(X)不起作用。
这是我的入门代码:
#include <allegro.h>
void Baslat();
void Bitir();
int main(){
Baslat();
while(!key[KEY_ESC]){
}
Bitir();
return 0;
}
END_OF_MAIN()
void Baslat(){
int depth,res;
allegro_init();
depth = desktop_color_depth();
if(depth == 0) depth=32;
set_color_depth(depth);
res=set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640,480,0,0);
if(res!=0){
allegro_message("%s\n", allegro_error); exit(-1);
}
install_timer();
install_keyboard();
install_mouse();
}
void Bitir(){
clear_keybuf();
}
【问题讨论】:
-
尝试调试?在调试器中运行您的应用程序,并在退出时按 Ctrl+C。
-
我根据标签回答了
allegro5,但看起来您实际上是在使用allegro4。您对哪个版本的 allegro 感兴趣?