11 #include <SFML/Graphics/RenderTexture.hpp> 12 #include <SFML/Graphics/Sprite.hpp> 13 #include <SFML/Graphics/Transformable.hpp> 14 #include <SFML/Graphics/View.hpp> 16 #include <NasNas/core/data/Rect.hpp> 17 #include <NasNas/core/data/ShaderHolder.hpp> 31 Camera(std::string name,
int render_order);
46 void reset(
int x,
int y,
int w,
int h);
54 void reset(
const sf::Vector2i& position,
const sf::Vector2i& size);
86 void resetViewport(
const sf::Vector2f& position,
const sf::Vector2f& size);
129 void follow(sf::Transformable& transformable);
173 auto getFolloweePosition()
const ->
const sf::Vector2f&;
208 auto getTop()
const -> float;
249 std::optional<sf::Transformable*> m_followee;
250 unsigned int m_frames_delay;
256 std::unique_ptr<sf::RenderTexture> m_render_texture;
263 void render(sf::RenderTarget& target);
265 auto getSprite()
const ->
const sf::Sprite&;
267 using sf::View::reset;
268 using sf::View::setViewport;
auto getRenderOrder() const -> int
Get render order of the Camera.
void setVisible(bool value)
Show or hide the Camera content.
void lookAt(Scene &scene)
Tell the Camera to look at a Scene.
auto getBottom() const -> float
Get Camera bottom position in world's coordinates.
Camera(std::string name, int render_order)
Construct a Camera object.
auto getRight() const -> float
Get Camera right position in world's coordinates.
void setLeft(float value)
Set Camera left position in world's coordinates.
void update()
Updates Camera position if following an entity.
void follow(sf::Transformable &transformable)
Follow an entity, Camera position will be updated accordingly automatically.
auto getFramesDelay() const -> unsigned int
auto getGlobalBounds() const -> ns::FloatRect
Get camera global bounds.
auto hasScene() -> bool
Is the Camera looking at a Scene ?
void setLimitsRect(const ns::IntRect &rectangle)
Sets Camera move limits.
auto getLeft() const -> float
Get Camera left position in world's coordinates.
void reset(int x, int y, int w, int h)
Reset Camera size and position.
auto getPosition() const -> sf::Vector2f
Get Camera position in world's coordinates.
void setFramesDelay(unsigned int value)
Set the frame delay.
void resetViewport(float x, float y, float w, float h)
Reset Camera viewport.
auto getTop() const -> float
Get Camera top position in world's coordinates.
void setBottom(float value)
Set Camera bottom position in world's coordinates.
auto isVisible() const -> bool
Is the Camera visible ?
void setTop(float value)
Set Camera top position in world's coordinates.
void setRight(float value)
Set Camera right position in world's coordinates.