Mercurial > fife-parpg
diff engine/core/view/renderers/genericrenderer.cpp @ 680:60621d858548
* Fixed the image/animation functions in GenericRenderer and LightRenderer. The functions now consider the camera zoom level.
* Added the forgotten LightEdit plugin for the editor.
author | helios2000@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sun, 21 Nov 2010 15:58:14 +0000 |
parents | e3140f01749d |
children |
line wrap: on
line diff
--- a/engine/core/view/renderers/genericrenderer.cpp Thu Nov 18 17:28:15 2010 +0000 +++ b/engine/core/view/renderers/genericrenderer.cpp Sun Nov 21 15:58:14 2010 +0000 @@ -328,10 +328,12 @@ Image* img = &imagepool->getImage(m_image); Rect r; Rect viewport = cam->getViewPort(); - r.x = p.x-img->getWidth()/2; - r.y = p.y-img->getHeight()/2; - r.w = img->getWidth(); - r.h = img->getHeight(); + unsigned int widtht = round(img->getWidth() * cam->getZoom()); + unsigned int height = round(img->getHeight() * cam->getZoom()); + r.x = p.x-widtht/2; + r.y = p.y-height/2; + r.w = widtht; + r.h = height; if(r.intersects(viewport)) img->render(r); } @@ -352,10 +354,12 @@ Image* img = animation.getFrameByTimestamp(animtime); Rect r; Rect viewport = cam->getViewPort(); - r.x = p.x-img->getWidth()/2; - r.y = p.y-img->getHeight()/2; - r.w = img->getWidth(); - r.h = img->getHeight(); + unsigned int widtht = round(img->getWidth() * cam->getZoom()); + unsigned int height = round(img->getHeight() * cam->getZoom()); + r.x = p.x-widtht/2; + r.y = p.y-height/2; + r.w = widtht; + r.h = height; if(r.intersects(viewport)) img->render(r); } @@ -397,13 +401,16 @@ if(m_anchor.getLayer() == layer) { Image* img = &imagepool->getImage(m_image); Rect r; - r.x = p.x-m_width/2; - r.y = p.y-m_height/2; - r.w = m_width; - r.h = m_height; - renderbackend->disableLighting(); - img->render(r); - renderbackend->enableLighting(); + Rect viewport = cam->getViewPort(); + unsigned int widtht = round(m_width * cam->getZoom()); + unsigned int height = round(m_height * cam->getZoom()); + r.x = p.x-widtht/2; + r.y = p.y-height/2; + r.w = widtht; + r.h = height; + if(r.intersects(viewport)) { + img->render(r); + } } }