void SurfaceCluster::render(RenderTarget& target) const { for (std::vector<Blit::SurfaceCluster::Elem>::const_iterator surf = elems.begin(); surf != elems.end(); surf++) { target.blit_offset(surf->surf, Rect(), position + (func ? func(surf->offset) : surf->offset)); } }
void Font::render_msg(RenderTarget& target, const string& str, int x, int y, Font::RenderAlignment dir, int newline_offset) const { int orig_x = x; std::vector<std::string> lines = Utils::split(str, '\n'); for (std::vector<std::string>::iterator line = lines.begin(); line!=lines.end(); line++ ) { x -= Font::adjust_x(*line, dir); for (std::string::iterator c = line->begin(); c!=line->end(); c++) { const Surface& surf = surface(*c); target.blit_offset(surf, Rect(), Pos(x, y)); x += glyphwidth; } y += glyphheight + newline_offset; x = orig_x; } }