Add More Event Handling Functions.

Remove Debug Message in _global_timer_executor...
This commit is contained in:
Kirigaya Kazuto 2017-05-05 17:28:11 +08:00
parent 3e2479e216
commit a33a27dbb0
3 changed files with 19 additions and 2 deletions

View File

@ -1404,7 +1404,6 @@ namespace MiniEngine
/// Global Executor For class Timer
Uint32 _global_timer_executor(Uint32 interval,void* param)
{
printf("DEBUG: Global Timer Executor.\n");
auto p=reinterpret_cast<std::function<Uint32(Uint32 interval)>*>(param);
return (*p)(interval);
}

View File

@ -20,6 +20,21 @@ int PushEvent(const Event& refEvent)
return SDL_PushEvent(const_cast<Event*>(&refEvent));
}
void PumpEvents()
{
SDL_PumpEvents();
}
bool HasEvent(decltype(Event::type) EventType)
{
return ( SDL_HasEvent(EventType)==SDL_TRUE );
}
bool HasEvent(decltype(Event::type) EventTypeMin,decltype(Event::type) EventTypeMax)
{
return ( SDL_HasEvents(EventTypeMin,EventTypeMax)==SDL_TRUE );
}
bool operator == (const LooperID& a,const LooperID& b)
{
return a._type_id==b._type_id && a._looper_cnt==b._looper_cnt ;

View File

@ -9,6 +9,9 @@ int PollEvent(Event& refEvent);
int WaitEvent(Event& refEvent);
int WaitEventTimeout(Event& refEvent,int ms);
int PushEvent(const Event& refEvent);
void PumpEvents();
bool HasEvent(decltype(Event::type) EventType);
bool HasEvent(decltype(Event::type) EventTypeMin,decltype(Event::type) EventTypeMax);
typedef struct
{
@ -86,4 +89,4 @@ public:
void run();
protected:
int _timeout_ms;
};
};