Arm*_*yan 2 c c++ windows allegro allegro5
以下是来自Allegro5教程的示例:(要查看原始示例,请点击链接,我已将其简化为插图目的.
#include <allegro5/allegro.h>
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
al_init()
display = al_create_display(640, 480);
event_queue = al_create_event_queue();
al_register_event_source(event_queue, al_get_display_event_source(display));
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
while(1)
{
ALLEGRO_EVENT ev;
ALLEGRO_TIMEOUT timeout;
al_init_timeout(&timeout, 0.06);
bool get_event = al_wait_for_event_until(event_queue, &ev, &timeout);
//-->// if(get_event && ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
//-->// break;
//-->// }
al_clear_to_color(al_map_rgb(0,0,0));
al_flip_display();
}
al_destroy_display(display);
al_destroy_event_queue(event_queue);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果我不手动检查ALLEGRO_EVENT_DISPLAY_CLOSE,那么我无法关闭窗口或终止程序(不通过任务管理器终止进程).我理解这一点.但在这种情况下,我不明白最小化按钮如何工作,没有我手动处理它.有人可以解释一下吗?
免责声明:我不知道Allegro.
最小化最基本级别的窗口只涉及处理窗口(窗口管理器)的过程,而不是过程本身.终止程序通常需要关闭文件或释放内存或者只有进程本身可以执行的其他操作.
| 归档时间: |
|
| 查看次数: |
1174 次 |
| 最近记录: |