client/Camera.cpp
// logical coordinates
// should only render if visible to player
logical coordinates
should only render if visible to player
logical coordinates should only render if visible to player
void Camera::renderInSight(SdlTexture& texture,
                           Area& src,
                           float posX,
                           float posY,
                           float angle) {
    if (!isVisible(posX, posY)) {
        return;
    }
    auto rect = src.buildRectangle();
    int newX = centerPix.x - (logicalCenterX - posX) * M_TO_P;
    int newY = centerPix.y - (logicalCenterY - posY) * M_TO_P;
    Area dst(newX - (rect.w / 2),
             newY - (rect.h / 2),
             rect.w, rect.h);
    texture.render(src, dst, angle, SDL_FLIP_NONE);
}
void Camera :: renderInSight ( SdlTexture & texture , Area & src , float posX , float posY , float angle ) { if ( ! isVisible ( posX , posY ) ) { return ; } auto rect = src . buildRectangle ( ) ; int newX = centerPix . x - ( logicalCenterX - posX ) * M_TO_P ; int newY = centerPix . y - ( logicalCenterY - posY ) * M_TO_P ; Area dst ( newX - ( rect . w / 2 ) , newY - ( rect . h / 2 ) , rect . w , rect . h ) ; texture . render ( src , dst , angle , SDL_FLIP_NONE ) ; }
logical coordinates
should only render if visible to player
logical coordinates should only render if visible to player