Camera class. Camera that can follow target a ship. Zoom and Independent movement also possible. Handles drawing of HUD, only if a ship is targeted.
More...
#include <Camera.hpp>
|
void | drawText (std::string info, sf::Vector2f pos, sf::Color color) |
|
void | drawRadarObj (sf::ConvexShape *shape) |
| Draws a color text at pos to HUD, called by drawHUD() More...
|
|
sf::Vector2f | worldToRadar (sf::Vector2f const &worldPos) |
| Converts a vector from world space down through range and into radar on-screen space. More...
|
|
sf::Vector2f | translateVector (sf::Vector2f pos, sf::FloatRect src, sf::FloatRect dest) |
| Translates pos in coordinate space src to equivalent in coord space dest. More...
|
|
Camera class. Camera that can follow target a ship. Zoom and Independent movement also possible. Handles drawing of HUD, only if a ship is targeted.
Camera::Camera |
( |
sf::RenderTarget & |
target | ) |
|
void Camera::clearTarget |
( |
bool |
savexf | ) |
|
Clears the camera's target, can keep camera on target's last position or reset.
HUD Drawing controls, both of these change render target for their duration.
void Camera::drawRadar |
( |
std::list< Ship * > & |
objList, |
|
|
sf::Vector2f |
centre, |
|
|
float |
radius |
|
) |
| |
void Camera::drawRadarObj |
( |
sf::ConvexShape * |
shape | ) |
|
|
private |
Draws a color text at pos to HUD, called by drawHUD()
Draws a single radar object to radar, called by drawRadar()
void Camera::drawText |
( |
std::string |
info, |
|
|
sf::Vector2f |
pos = sf::Vector2f(0, 0) , |
|
|
sf::Color |
color = sf::Color::White |
|
) |
| |
|
private |
Ship * Camera::getTarget |
( |
| ) |
|
float Camera::getZoomPercent |
( |
| ) |
const |
Returns zoom factor as a percentage.
void Camera::loadFont |
( |
std::string |
filename | ) |
|
Loads a font, required for drawing HUD.
void Camera::move |
( |
sf::Vector2f |
xf | ) |
|
Move controls for the camera.
void Camera::moveReset |
( |
| ) |
|
void Camera::setTarget |
( |
Ship * |
target | ) |
|
sf::Vector2f Camera::translateVector |
( |
sf::Vector2f |
pos, |
|
|
sf::FloatRect |
src, |
|
|
sf::FloatRect |
dest |
|
) |
| |
|
private |
Translates pos in coordinate space src to equivalent in coord space dest.
Updates camera's center to where the target is.
sf::Vector2f Camera::worldToRadar |
( |
sf::Vector2f const & |
worldPos | ) |
|
|
private |
Converts a vector from world space down through range and into radar on-screen space.
Zoom controls for camera.
void Camera::zoomReset |
( |
| ) |
|
void Camera::zoomSet |
( |
float |
mult | ) |
|
sf::Vector2f Camera::move_ |
|
private |
Translation Vector of camera.
sf::Vector2f Camera::radarPos_ |
|
private |
Radar position within HUD.
sf::RenderTarget& Camera::rentrg_ |
|
private |
HUD is drawn to this target.
sf::Vector2f Camera::screenSize_ |
|
private |
Keep a record of the screen size for resets.
The target followed ship.
HUD is drawn with a single text.
float Camera::zoomFactor_ |
|
private |
The internal factor of the zoom.
The documentation for this class was generated from the following files: