mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +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;
|
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)
|
bool Event::getConstant(const char * in, love::mouse::Mouse::Button & out)
|
||||||
{
|
{
|
||||||
return buttons.find(in, out);
|
return buttons.find(in, out);
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ namespace event
|
|||||||
|
|
||||||
void push(Message *msg);
|
void push(Message *msg);
|
||||||
bool poll(Message *&msg);
|
bool poll(Message *&msg);
|
||||||
|
virtual void clear();
|
||||||
|
|
||||||
virtual void pump() = 0;
|
virtual void pump() = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -77,11 +77,7 @@ namespace sdl
|
|||||||
// Do nothing with 'e' ...
|
// Do nothing with 'e' ...
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!queue.empty())
|
love::event::Event::clear();
|
||||||
{
|
|
||||||
queue.back()->release();
|
|
||||||
queue.pop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Message *Event::convert(SDL_Event & e)
|
Message *Event::convert(SDL_Event & e)
|
||||||
|
|||||||
Reference in New Issue
Block a user