# HG changeset patch # User prock@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1289252198 0 # Node ID 46258f467c8c348e2c7fbba104c4249f154b6622 # Parent e8a799239384c7fa380a5f440ce905880d42f2aa * Fixed the clear screen problems. The screen is now automatically cleared every frame by the engine if there are no maps loaded. In the process I removed the setClearBackBuffer() function from the RenderBackend. diff -r e8a799239384 -r 46258f467c8c demos/rpg/scripts/rpg.py --- a/demos/rpg/scripts/rpg.py Mon Nov 08 20:37:31 2010 +0000 +++ b/demos/rpg/scripts/rpg.py Mon Nov 08 21:36:38 2010 +0000 @@ -148,8 +148,6 @@ super(RPGApplication,self).__init__(TDS) self._settings = TDS - self.engine.getRenderBackend().setClearBackBuffer(True) - self._gamecontroller = GameController(self, self.engine, self._settings) def createListener(self): diff -r e8a799239384 -r 46258f467c8c demos/shooter/run.py --- a/demos/shooter/run.py Mon Nov 08 20:37:31 2010 +0000 +++ b/demos/shooter/run.py Mon Nov 08 21:36:38 2010 +0000 @@ -73,8 +73,6 @@ self._world = world.World(self, self.engine, self._setting) self._listener = ApplicationListener(self.engine, self._world) - - self.engine.getRenderBackend().setClearBackBuffer(True) def requestQuit(self): cmd = fife.Command() diff -r e8a799239384 -r 46258f467c8c engine/core/controller/engine.cpp --- a/engine/core/controller/engine.cpp Mon Nov 08 20:37:31 2010 +0000 +++ b/engine/core/controller/engine.cpp Mon Nov 08 21:36:38 2010 +0000 @@ -363,6 +363,11 @@ m_eventmanager->processEvents(); m_renderbackend->startFrame(); m_timemanager->update(); + + if (m_model->getNumMaps() == 0) { + m_renderbackend->clearBackBuffer(); + } + m_model->update(); #ifdef HAVE_OPENGL if (m_settings.getLightingModel() == 1) { diff -r e8a799239384 -r 46258f467c8c engine/core/video/opengl/renderbackendopengl.cpp --- a/engine/core/video/opengl/renderbackendopengl.cpp Mon Nov 08 20:37:31 2010 +0000 +++ b/engine/core/video/opengl/renderbackendopengl.cpp Mon Nov 08 21:36:38 2010 +0000 @@ -47,7 +47,6 @@ m_rgba_format = *(testsurface->format); SDL_FreeSurface(testsurface); - m_clear = false; m_lightmodel = 0; m_light_enabled = false; m_stencil_enabled = false; @@ -162,9 +161,6 @@ void RenderBackendOpenGL::startFrame() { - if(m_clear) { - clearBackBuffer(); - } } void RenderBackendOpenGL::endFrame() { @@ -350,7 +346,7 @@ GLenum src_fact; GLenum dst_fact; - switch(src) { + switch(src) { case 0 : src_fact = GL_ZERO; break; case 1 : src_fact = GL_ONE; break; case 2 : src_fact = GL_DST_COLOR; break; @@ -363,7 +359,7 @@ default : src_fact = GL_DST_COLOR; break; } - switch(dst) { + switch(dst) { case 0 : dst_fact = GL_ZERO; break; case 1 : dst_fact = GL_ONE; break; case 2 : dst_fact = GL_SRC_COLOR; break; @@ -480,7 +476,7 @@ } for(float angle=0; angle<=Mathf::twoPi(); angle+=(Mathf::twoPi()/subdivisions)){ glVertex2f( radius*Mathf::Cos(angle)*xstretch + p.x, - radius*Mathf::Sin(angle)*ystretch + p.y); + radius*Mathf::Sin(angle)*ystretch + p.y); } glVertex2f(p.x+radius*xstretch, p.y); glEnd(); diff -r e8a799239384 -r 46258f467c8c engine/core/video/renderbackend.cpp --- a/engine/core/video/renderbackend.cpp Mon Nov 08 20:37:31 2010 +0000 +++ b/engine/core/video/renderbackend.cpp Mon Nov 08 21:36:38 2010 +0000 @@ -35,7 +35,6 @@ RenderBackend::RenderBackend(const SDL_Color& colorkey): m_screen(NULL), - m_clear(false), m_isalphaoptimized(false), m_iscolorkeyenabled(false), m_colorkey(colorkey) { diff -r e8a799239384 -r 46258f467c8c engine/core/video/renderbackend.h --- a/engine/core/video/renderbackend.h Mon Nov 08 20:37:31 2010 +0000 +++ b/engine/core/video/renderbackend.h Mon Nov 08 21:36:38 2010 +0000 @@ -219,14 +219,8 @@ */ const SDL_Color& getColorKey() const; - /** Sets if the backbuffer should be cleared before rendering the next frame. - * @param clear true = clear screen before next frame, false = do not clear screen - */ - void setClearBackBuffer(bool clear) { m_clear = clear; }; - protected: Image* m_screen; - bool m_clear; bool m_isalphaoptimized; unsigned int m_chunkingsize; bool m_iscolorkeyenabled; diff -r e8a799239384 -r 46258f467c8c engine/core/video/sdl/renderbackendsdl.cpp --- a/engine/core/video/sdl/renderbackendsdl.cpp Mon Nov 08 20:37:31 2010 +0000 +++ b/engine/core/video/sdl/renderbackendsdl.cpp Mon Nov 08 21:36:38 2010 +0000 @@ -42,7 +42,6 @@ static Logger _log(LM_VIDEO); RenderBackendSDL::RenderBackendSDL(const SDL_Color& colorkey) : RenderBackend(colorkey) { - m_clear = false; } @@ -135,9 +134,6 @@ } void RenderBackendSDL::startFrame() { - if (m_clear) { - clearBackBuffer(); - } } void RenderBackendSDL::endFrame() { diff -r e8a799239384 -r 46258f467c8c engine/core/video/video.i --- a/engine/core/video/video.i Mon Nov 08 20:37:31 2010 +0000 +++ b/engine/core/video/video.i Mon Nov 08 21:36:38 2010 +0000 @@ -185,7 +185,6 @@ bool isColorKeyEnabled() const; void setColorKey(const SDL_Color& colorkey); const SDL_Color& getColorKey() const; - void setClearBackBuffer(bool clear); }; enum MouseCursorType { diff -r e8a799239384 -r 46258f467c8c engine/core/view/camera.cpp --- a/engine/core/view/camera.cpp Mon Nov 08 20:37:31 2010 +0000 +++ b/engine/core/view/camera.cpp Mon Nov 08 21:36:38 2010 +0000 @@ -131,7 +131,6 @@ delete r_it->second; } m_renderers.clear(); - m_renderbackend->setClearBackBuffer(true); delete m_map_observer; } diff -r e8a799239384 -r 46258f467c8c tools/editor/scripts/editor.py --- a/tools/editor/scripts/editor.py Mon Nov 08 20:37:31 2010 +0000 +++ b/tools/editor/scripts/editor.py Mon Nov 08 21:36:38 2010 +0000 @@ -104,8 +104,6 @@ ApplicationBase.__init__(self, TDS, *args, **kwargs) MainWindow.__init__(self, *args, **kwargs) - self.engine.getRenderBackend().setClearBackBuffer(True) - def _initTools(self): """ Initializes tools """ self._pluginmanager = plugin.PluginManager(self.getSettings())