add exit event

This commit is contained in:
xiongziliang 2019-09-20 17:58:50 +08:00
parent 91adaaaab6
commit 9d43c38e09
1 changed files with 20 additions and 14 deletions

View File

@ -71,20 +71,26 @@ public:
SDL_Event event; SDL_Event event;
while(flag){ while(flag){
SDL_WaitEvent(&event); SDL_WaitEvent(&event);
if (event.type == REFRESH_EVENT) switch (event.type){
{ case REFRESH_EVENT:{
{ {
lock_guard<mutex> lck(_mtxTask); lock_guard<mutex> lck(_mtxTask);
if(_taskList.empty()){ if(_taskList.empty()){
//not reachable //not reachable
continue; continue;
} }
task = _taskList.front(); task = _taskList.front();
_taskList.pop_front(); _taskList.pop_front();
} }
flag = task(); flag = task();
} break;
case SDL_QUIT:
InfoL << event.type;
return;
}
default:
break;
}
} }
} }