# HG changeset patch # User helios2000@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1281731332 0 # Node ID 378b588216d64a44994f80a48923f51e7d9b9c75 # Parent 59c92d10d7bc47c815b1a6a2651847d513871413 * Improved addTransparentArea(). Now you can set a list with namespaces. diff -r 59c92d10d7bc -r 378b588216d6 engine/core/view/renderers/instancerenderer.cpp --- a/engine/core/view/renderers/instancerenderer.cpp Fri Aug 13 16:42:09 2010 +0000 +++ b/engine/core/view/renderers/instancerenderer.cpp Fri Aug 13 20:28:52 2010 +0000 @@ -162,16 +162,19 @@ } std::string str_name = instance->getObject()->getNamespace(); - if(str_name.find(infoa.groups) != -1) { - ScreenPoint p; - Rect rec; - p = cam->toScreenCoordinates(infoa.instance->getLocation().getMapCoordinates()); - rec.x = p.x - infoa.w / 2; - rec.y = p.y - infoa.h / 2; - rec.w = infoa.w; - rec.h = infoa.h; - if(infoa.instance != instance && vc.dimensions.intersects(rec)) { - vc.transparency = 255 - infoa.trans; + std::list::iterator group_it = infoa.groups.begin(); + for(;group_it != infoa.groups.end(); ++group_it) { + if(str_name.find((*group_it)) != -1) { + ScreenPoint p; + Rect rec; + p = cam->toScreenCoordinates(infoa.instance->getLocation().getMapCoordinates()); + rec.x = p.x - infoa.w / 2; + rec.y = p.y - infoa.h / 2; + rec.w = infoa.w; + rec.h = infoa.h; + if(infoa.instance != instance && vc.dimensions.intersects(rec)) { + vc.transparency = 255 - infoa.trans; + } } } } @@ -371,10 +374,11 @@ } } - void InstanceRenderer::addTransparentArea(Instance* instance, const std::string &groups, unsigned int w, unsigned int h, unsigned char trans, bool front) { + void InstanceRenderer::addTransparentArea(Instance* instance, const std::list &groups, unsigned int w, unsigned int h, unsigned char trans, bool front) { AreaInfo newinfo; newinfo.instance = instance; newinfo.groups = groups; + newinfo.w = w; newinfo.h = h; newinfo.trans = trans; diff -r 59c92d10d7bc -r 378b588216d6 engine/core/view/renderers/instancerenderer.h --- a/engine/core/view/renderers/instancerenderer.h Fri Aug 13 16:42:09 2010 +0000 +++ b/engine/core/view/renderers/instancerenderer.h Fri Aug 13 20:28:52 2010 +0000 @@ -24,6 +24,7 @@ // Standard C++ library includes #include +#include // 3rd party library includes @@ -68,7 +69,7 @@ /** Marks given instance to have an transparent area with given paramters */ - void addTransparentArea(Instance* instance, const std::string &groups, unsigned int w, unsigned int h, unsigned char trans, bool front = true); + void addTransparentArea(Instance* instance, const std::list &groups, unsigned int w, unsigned int h, unsigned char trans, bool front = true); /** Removes instance from outlining list */ @@ -133,7 +134,8 @@ class AreaInfo { public: Instance* instance; - std::string groups; + //std::string groups; + std::list groups; unsigned int w; unsigned int h; unsigned char trans; diff -r 59c92d10d7bc -r 378b588216d6 engine/core/view/renderers/instancerenderer.i --- a/engine/core/view/renderers/instancerenderer.i Fri Aug 13 16:42:09 2010 +0000 +++ b/engine/core/view/renderers/instancerenderer.i Fri Aug 13 20:28:52 2010 +0000 @@ -25,6 +25,8 @@ %} namespace FIFE { + %apply const std::list &OUTPUT {std::list &groups}; + class Location; class RenderBackend; class ImagePool; @@ -40,11 +42,12 @@ void addColored(Instance* instance, int r, int g, int b); void removeColored(Instance* instance); void removeAllColored(); - void addTransparentArea(Instance* instance, const std::string &groups, unsigned int w, unsigned int h, unsigned char trans, bool front = true); + void addTransparentArea(Instance* instance, const std::list &groups, unsigned int w, unsigned int h, unsigned char trans, bool front = true); void removeTransparentArea(Instance* instance); void removeAllTransparentAreas(); static InstanceRenderer* getInstance(IRendererContainer* cnt); private: InstanceRenderer(RenderBackend* renderbackend, int position, ImagePool* imagepool, AnimationPool* animpool); }; + %clear std::list &groups; }