mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Make love.event.clear thread-safe, though it's only callable from the main thread (with SDL backend, anyway)
This commit is contained in:
@@ -99,6 +99,16 @@ namespace event
|
||||
return true;
|
||||
}
|
||||
|
||||
void Event::clear()
|
||||
{
|
||||
Lock lock(mutex);
|
||||
while (!queue.empty())
|
||||
{
|
||||
queue.back()->release();
|
||||
queue.pop();
|
||||
}
|
||||
}
|
||||
|
||||
bool Event::getConstant(const char * in, love::mouse::Mouse::Button & out)
|
||||
{
|
||||
return buttons.find(in, out);
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace event
|
||||
|
||||
void push(Message *msg);
|
||||
bool poll(Message *&msg);
|
||||
virtual void clear();
|
||||
|
||||
virtual void pump() = 0;
|
||||
|
||||
|
||||
@@ -77,11 +77,7 @@ namespace sdl
|
||||
// Do nothing with 'e' ...
|
||||
}
|
||||
|
||||
while (!queue.empty())
|
||||
{
|
||||
queue.back()->release();
|
||||
queue.pop();
|
||||
}
|
||||
love::event::Event::clear();
|
||||
}
|
||||
|
||||
Message *Event::convert(SDL_Event & e)
|
||||
|
||||
Reference in New Issue
Block a user