我无法注销输出 C 程序



>我正在使用快板库开发一款游戏。我写了一个启动器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("%sn", allegro_error);                  exit(-1);
}
install_timer();
install_keyboard();
install_mouse();
}

void Bitir(){
clear_keybuf();
}

要响应用户在 allegro5 中按下X按钮,您必须捕获ALLEGRO_EVENT_DISPLAY_CLOSE。本教程提供了响应该事件的示例。

最新更新