Merge minor into dynamiccore2

--HG--
branch : dynamiccore2
This commit is contained in:
Bart van Strien
2016-11-26 22:19:12 +01:00
61 changed files with 4909 additions and 1720 deletions
+17
View File
@@ -112,6 +112,8 @@ Event::~Event()
void Event::pump()
{
exceptionIfInRenderPass();
SDL_Event e;
while (SDL_PollEvent(&e))
@@ -127,6 +129,8 @@ void Event::pump()
Message *Event::wait()
{
exceptionIfInRenderPass();
SDL_Event e;
if (SDL_WaitEvent(&e) != 1)
@@ -137,6 +141,8 @@ Message *Event::wait()
void Event::clear()
{
exceptionIfInRenderPass();
SDL_Event e;
while (SDL_PollEvent(&e))
@@ -147,6 +153,17 @@ void Event::clear()
love::event::Event::clear();
}
void Event::exceptionIfInRenderPass()
{
// Some core OS graphics functionality (e.g. swap buffers on some platforms)
// happens inside SDL_PumpEvents - which is called by SDL_PollEvent and
// friends. It's probably a bad idea to call those functions while we're in
// a render pass.
auto gfx = Module::getInstance<graphics::Graphics>(Module::M_GRAPHICS);
if (gfx != nullptr && gfx->isPassActive())
throw love::Exception("Cannot call this function while a render pass is active in love.graphics.");
}
Message *Event::convert(const SDL_Event &e) const
{
Message *msg = nullptr;
+2
View File
@@ -68,6 +68,8 @@ public:
private:
void exceptionIfInRenderPass();
Message *convert(const SDL_Event &e) const;
Message *convertJoystickEvent(const SDL_Event &e) const;
Message *convertWindowEvent(const SDL_Event &e) const;