SFML community forums
Help => Graphics => Topic started by: CytraL on August 31, 2010, 07:06:06 pm
-
If using sf:: View draws only what you see on screen automatically? or need make a function for control this...
-
It draws everything, so if you need a performances boost you can manually exclude what is outside the screen.
-
It will draw whether it is inside or outside the view. You need to make a control for this. (if not inside the view then no draw)
-
ok... thx ;)
void CMap::drawLayer(int nlayer)
{
sf::FloatRect vrect = engine.camera.GetRect();
INFO_LAYER *layer = &layers[nlayer];
int gX, gY;
for(std::size_t i=0; i<layer->map.size(); ++i)
{
if (layer->map[i]->gid > 0)
{
gX = i;
gY = int(i/info_map.w);
if (gX > info_map.w)
gX-=info_map.w*gY;
if ((gX*64+32 >= vrect.Left && gX*64-32 <= vrect.Right) && (gY*64+32 >= vrect.Top && gY*64-32 <= vrect.Bottom))
engine.screen.Draw(layer->map[i]->sprt_tile);
}
}
}
----------------------------------
Other question... How i can make sf::shape with alpha??