Mercurial > fife-parpg
comparison engine/core/video/sdl/renderbackendsdl.cpp @ 634:5f381fa34769
* Added the clearBackBuffer() function to the renderbackends.
* Renamed setClearScreen() to setClearBackBuffer()
* The SDL render backend now honors what was set with setClearBackBuffer()
* Documented testRenderedViewPort()
* The OpenGL backend no longer clears the screen every frame by default. testRenderedViewPort() takes care of clearing the screen for now. Note: if the user overrides the default and enables clearing of the backbuffer that it may be cleared twice in one frame (OpenGL only)!
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 06 Oct 2010 15:49:53 +0000 |
parents | 46b95d06c8c2 |
children | 855ad500f991 |
comparison
equal
deleted
inserted
replaced
633:46b95d06c8c2 | 634:5f381fa34769 |
---|---|
58 throw SDLException(SDL_GetError()); | 58 throw SDLException(SDL_GetError()); |
59 | 59 |
60 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // temporary hack | 60 SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // temporary hack |
61 } | 61 } |
62 | 62 |
63 void RenderBackendSDL::clearBackBuffer() { | |
64 SDL_Rect rect; | |
65 rect.x = 0; | |
66 rect.y = 0; | |
67 rect.w = getWidth(); | |
68 rect.h = getHeight(); | |
69 SDL_SetClipRect(m_screen->getSurface(), &rect); | |
70 SDL_FillRect(m_screen->getSurface(), 0, 0x00); | |
71 } | |
72 | |
63 Image* RenderBackendSDL::createMainScreen(unsigned int width, unsigned int height, unsigned char bitsPerPixel, bool fs, const std::string& title, const std::string& icon) { | 73 Image* RenderBackendSDL::createMainScreen(unsigned int width, unsigned int height, unsigned char bitsPerPixel, bool fs, const std::string& title, const std::string& icon) { |
64 Uint32 flags = 0; | 74 Uint32 flags = 0; |
65 if (fs) { | 75 if (fs) { |
66 flags |= SDL_FULLSCREEN; | 76 flags |= SDL_FULLSCREEN; |
67 } | 77 } |
118 m_screen = new SDLImage(screen); | 128 m_screen = new SDLImage(screen); |
119 return m_screen; | 129 return m_screen; |
120 } | 130 } |
121 | 131 |
122 void RenderBackendSDL::startFrame() { | 132 void RenderBackendSDL::startFrame() { |
123 SDL_Rect rect; | 133 if (m_clear) { |
124 rect.x = 0; | 134 clearBackBuffer(); |
125 rect.y = 0; | 135 } |
126 rect.w = getWidth(); | |
127 rect.h = getHeight(); | |
128 SDL_SetClipRect(m_screen->getSurface(), &rect); | |
129 SDL_FillRect(m_screen->getSurface(), 0, 0x00); | |
130 } | 136 } |
131 | 137 |
132 void RenderBackendSDL::endFrame() { | 138 void RenderBackendSDL::endFrame() { |
133 SDL_Flip(m_screen->getSurface()); | 139 SDL_Flip(m_screen->getSurface()); |
134 } | 140 } |