Mercurial > fife-parpg
diff engine/core/view/renderers/floatingtextrenderer.cpp @ 579:b2feacaed53c
* Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL.
* Improved the most renderers with setColor() function.
* Fixed the genericrenderer, is now tested whether the images are in the viewport.
* Fixed the gridrenderer, the grid is now drawn only up to the viewport.
* Changed the vertex functions in opengl/renderbackendopengl.cpp from vertex3f() to vertex2f().
* Improved the Editor, now you can use blocking, grid and coordinate renderer over gui or keys. Additionally, the colors can be changed with the settings.xml.
author | helios2000@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 31 Jul 2010 17:46:19 +0000 |
parents | 7b451e3b2439 |
children | 5e04f6349894 |
line wrap: on
line diff
--- a/engine/core/view/renderers/floatingtextrenderer.cpp Fri Jul 30 23:48:26 2010 +0000 +++ b/engine/core/view/renderers/floatingtextrenderer.cpp Sat Jul 31 17:46:19 2010 +0000 @@ -48,13 +48,17 @@ FloatingTextRenderer::FloatingTextRenderer(RenderBackend* renderbackend, int position, AbstractFont* font): RendererBase(renderbackend, position), m_font(font) { - setEnabled(true); + setEnabled(false); + m_font_color = false; + m_color = m_font->getColor(); } FloatingTextRenderer::FloatingTextRenderer(const FloatingTextRenderer& old): RendererBase(old), - m_font(old.m_font) { - setEnabled(true); + m_font(old.m_font), + m_font_color(old.m_font_color), + m_color(old.m_color) { + setEnabled(false); } RendererBase* FloatingTextRenderer::clone() { @@ -71,7 +75,11 @@ RenderList::const_iterator instance_it = instances.begin(); const std::string* saytext = NULL; - + SDL_Color old_color = m_font->getColor(); + if(old_color.r != m_color.r || old_color.g != m_color.g || old_color.b != m_color.b) { + m_font->setColor(m_color.r, m_color.g, m_color.b); + m_font_color = true; + } for (;instance_it != instances.end(); ++instance_it) { Instance* instance = (*instance_it)->instance; saytext = instance->getSayText(); @@ -86,6 +94,16 @@ img->render(r); } } + if(m_font_color) { + m_font->setColor(old_color.r, old_color.g, old_color.b); + m_font_color = false; + } + } + + void FloatingTextRenderer::setColor(Uint8 r, Uint8 g, Uint8 b) { + m_color.r = r; + m_color.g = g; + m_color.b = b; } FloatingTextRenderer* FloatingTextRenderer::getInstance(IRendererContainer* cnt) {