diff --git a/src/Engine/Platform/AbstractPlatformEventQueue.cpp b/src/Engine/Platform/AbstractPlatformEventQueue.cpp index 3b76b1b97..f06f6fcbb 100644 --- a/src/Engine/Platform/AbstractPlatformEventQueue.cpp +++ b/src/Engine/Platform/AbstractPlatformEventQueue.cpp @@ -52,7 +52,7 @@ void AbstractPlatformEventQueue::processEvents(Common::EventTriggerer *triggerer EventBus *eventBus = getEventBus(); osre_assert(nullptr != eventBus); while (!theList->isEmpty()) { - Common::EventData *eventData = theList->front(); + EventData *eventData = theList->front(); if (nullptr != eventData) { eventBus->publish(eventData->getEvent(), eventData); triggerer->triggerEvent(eventData->getEvent(), eventData); diff --git a/src/Engine/Platform/sdl2/SDL2EventQueue.cpp b/src/Engine/Platform/sdl2/SDL2EventQueue.cpp index 7708cd186..eafe0f9e1 100644 --- a/src/Engine/Platform/sdl2/SDL2EventQueue.cpp +++ b/src/Engine/Platform/sdl2/SDL2EventQueue.cpp @@ -39,16 +39,14 @@ using namespace ::OSRE::RenderBackend; using namespace ::cppcore; -static const c8 *Tag = "SDL2EventHandler"; +static constexpr c8 Tag[] = "SDL2EventHandler"; //------------------------------------------------------------------------------------------------- // The abstract interface for sdl2-based event updates. //------------------------------------------------------------------------------------------------- struct AbstractSDL2InputUpdate { // The virtual destructor. - virtual ~AbstractSDL2InputUpdate() { - // empty - } + virtual ~AbstractSDL2InputUpdate() = default; // Will perform the update. virtual bool update(SDL_Event *ev) = 0; @@ -57,19 +55,15 @@ struct AbstractSDL2InputUpdate { //------------------------------------------------------------------------------------------------- // Implements a get update, waits for the next event. //------------------------------------------------------------------------------------------------- -struct SDL2GetInputUpdate : public AbstractSDL2InputUpdate { +struct SDL2GetInputUpdate final : public AbstractSDL2InputUpdate { // The default constructor. - SDL2GetInputUpdate() { - // empty - } + SDL2GetInputUpdate() = default; // The destructor. - ~SDL2GetInputUpdate() { - // empty - } + ~SDL2GetInputUpdate() override = default; // Update implemented as a wait operation, will get the next upcoming event. - bool update(SDL_Event *ev) { + bool update(SDL_Event *ev) override { const i32 ret = SDL_WaitEvent(ev); if (0 == ret) { return false; @@ -82,19 +76,15 @@ struct SDL2GetInputUpdate : public AbstractSDL2InputUpdate { //------------------------------------------------------------------------------------------------- // Implements a peek update, polls for the next event. //------------------------------------------------------------------------------------------------- -struct SDL2PeekInputUpdate : public AbstractSDL2InputUpdate { +struct SDL2PeekInputUpdate final : public AbstractSDL2InputUpdate { // The default constructor. - SDL2PeekInputUpdate() { - // empty - } + SDL2PeekInputUpdate() = default; // The destructor. - ~SDL2PeekInputUpdate() { - // empty - } + ~SDL2PeekInputUpdate() override = default; // Update implemented as a poll operation, will check for a new event. - bool update(SDL_Event *ev) { + bool update(SDL_Event *ev) override { const i32 ret = ::SDL_PollEvent(ev); if (0 == ret) { return false; @@ -146,10 +136,7 @@ SDL2EventHandler::~SDL2EventHandler() { unregisterAllMenuCommands(); delete m_eventTriggerer; - m_eventTriggerer = nullptr; - delete m_inputUpdate; - m_inputUpdate = nullptr; } bool SDL2EventHandler::update() { @@ -193,15 +180,13 @@ bool SDL2EventHandler::update() { case SDL_WINDOWEVENT: { if (ev.window.windowID == windowID) { switch (ev.window.event) { - case SDL_WINDOWEVENT_MOVED: { - ui32 x = (ui32)ev.window.data1; - ui32 y = (ui32)ev.window.data2; - getRenderBackendService()->resize(x, y, mWindow->getProperties()->m_width, mWindow->getProperties()->m_width); + case SDL_WINDOWEVENT_EXPOSED: { + getRenderBackendService()->resize(mWindow->getProperties()->m_x, mWindow->getProperties()->m_y, mWindow->getProperties()->m_width, mWindow->getProperties()->m_width); } break; - + case SDL_WINDOWEVENT_SHOWN: case SDL_WINDOWEVENT_SIZE_CHANGED: { - ui32 w = ev.window.data1; - ui32 h = ev.window.data2; + const ui32 w = (ui32) ev.window.data1; + const ui32 h = (ui32) ev.window.data2; getRenderBackendService()->resize(mWindow->getProperties()->m_x, mWindow->getProperties()->m_y, w, h); } break; } diff --git a/src/Engine/Platform/sdl2/SDL2OGLRenderContext.cpp b/src/Engine/Platform/sdl2/SDL2OGLRenderContext.cpp index ba36a9b72..e5b71729e 100644 --- a/src/Engine/Platform/sdl2/SDL2OGLRenderContext.cpp +++ b/src/Engine/Platform/sdl2/SDL2OGLRenderContext.cpp @@ -58,7 +58,6 @@ bool SDL2RenderContext::onCreate(AbstractWindow *window) { return false; } - printf("Creating\n"); const GLubyte *version = glGetString( GL_VERSION ); osre_info(Tag, "OpenGL renderer initiated."); osre_info(Tag, "Version : " + String((c8*)version)); diff --git a/src/Engine/Platform/sdl2/SDL2Window.cpp b/src/Engine/Platform/sdl2/SDL2Window.cpp index e8d7f4391..9109f7eb5 100644 --- a/src/Engine/Platform/sdl2/SDL2Window.cpp +++ b/src/Engine/Platform/sdl2/SDL2Window.cpp @@ -118,14 +118,13 @@ bool SDL2Surface::onUpdateProperies() { } void SDL2Surface::onResize( ui32 x, ui32 y, ui32 w, ui32 h ) { - printf("resizing\n"); if ( nullptr == m_surface ) { return; } SDL_SetWindowPosition( m_surface, x, y ); SDL_SetWindowSize( m_surface, w, h ); - WindowsProperties *props( AbstractWindow::getProperties() ); + WindowsProperties *props = AbstractWindow::getProperties(); if ( nullptr != props ) { props->m_x = x; props->m_y = y; diff --git a/src/Engine/RenderBackend/OGLRenderer/OGLRenderEventHandler.cpp b/src/Engine/RenderBackend/OGLRenderer/OGLRenderEventHandler.cpp index 792fe4110..1a254698b 100644 --- a/src/Engine/RenderBackend/OGLRenderer/OGLRenderEventHandler.cpp +++ b/src/Engine/RenderBackend/OGLRenderer/OGLRenderEventHandler.cpp @@ -110,7 +110,7 @@ void OGLRenderEventHandler::enqueueRenderCmd(OGLRenderCmd *oglRenderCmd) { m_renderCmdBuffer->enqueueRenderCmd(oglRenderCmd); } -void OGLRenderEventHandler::setParameter(const ::cppcore::TArray ¶mArray) { +void OGLRenderEventHandler::setParameter(const TArray ¶mArray) { osre_assert(m_renderCmdBuffer != nullptr); m_renderCmdBuffer->setParameter(paramArray); @@ -233,7 +233,6 @@ bool OGLRenderEventHandler::onDetachView(const EventData *) { } bool OGLRenderEventHandler::onClearGeo(const EventData *) { - printf("OGLRenderEventHandler::onClearGeo\n"); osre_assert(nullptr != m_oglBackend); osre_assert(nullptr != m_renderCmdBuffer); @@ -300,7 +299,7 @@ bool OGLRenderEventHandler::addMeshes(const c8 *id, cppcore::TArray &pri return true; } -bool OGLRenderEventHandler::onInitRenderPasses(const Common::EventData *eventData) { +bool OGLRenderEventHandler:: onInitRenderPasses(const Common::EventData *eventData) { osre_assert(nullptr != m_oglBackend); InitPassesEventData *frameToCommitData = (InitPassesEventData*) eventData;