![]() |
FastEngine 0.9.4
A multiplayer oriented 2D engine made with Vulkan.
|
Define a camera in a 2D scene. More...
#include <C_view.hpp>
Public Member Functions | |
| View (fge::vulkan::Viewport const &viewport) | |
| View (Vector2f const ¢er, Vector2f const &size) | |
| void | setCenter (Vector2f const ¢er) |
| Vector2f const & | getCenter () const |
| void | setSize (Vector2f const &size) |
| Set the size of the view. | |
| Vector2f const & | getSize () const |
| void | setRotation (float angleDeg) |
| float | getRotation () const |
| void | setFactorViewport (fge::RectFloat const &factorViewport) |
| Set the viewport rectangle of the view. | |
| fge::RectFloat const & | getFactorViewport () const |
| void | reset (fge::vulkan::Viewport const &viewport) |
| Reset the view to the given viewport. | |
| void | move (Vector2f const &offset) |
| Helper function to move the view. | |
| void | rotate (float angle) |
| Helper function to rotate the view. | |
| void | zoom (float factor) |
| Helper function to zoom the view. | |
| void | resizeFixCenter (fge::Vector2f const &newSize) |
| Resize the view and move it relatively to old center in order to expand it. | |
| glm::mat4 const & | getTransform () const |
| Get the transform of the view. | |
| glm::mat4 const & | getInverseTransform () const |
| glm::mat4 const & | getProjection () const |
| Get the projection matrix of the view. | |
| glm::mat4 const & | getInverseProjection () const |
Define a camera in a 2D scene.
A view is a 2D camera that defines what part of the 2D scene is visible.
|
nodiscard |
Get the projection matrix of the view.
This function returns the a orthogonal projection matrix.
|
nodiscard |
Get the transform of the view.
This function returns the transform matrix.
| void fge::View::move | ( | Vector2f const & | offset | ) |
Helper function to move the view.
| offset | Offset to apply to the view |
| void fge::View::reset | ( | fge::vulkan::Viewport const & | viewport | ) |
Reset the view to the given viewport.
The size and center of the view are adjusted so that the entire viewport is visible. The rotation is reset to 0.
| viewport | New viewport to apply to the view |
| void fge::View::resizeFixCenter | ( | fge::Vector2f const & | newSize | ) |
Resize the view and move it relatively to old center in order to expand it.
| newSize | New size of the view |
| void fge::View::rotate | ( | float | angle | ) |
Helper function to rotate the view.
| angle | Angle to apply to the view, in degrees |
| void fge::View::setFactorViewport | ( | fge::RectFloat const & | factorViewport | ) |
Set the viewport rectangle of the view.
The viewport is the rectangle into which the contents of the view are displayed, expressed as a factor (between 0 and 1) of the size of the RenderTarget to which the view is applied.
For example, a view which takes the left side of the target would be defined by:
| factorViewport | New viewport rectangle, expressed as a factor of the render-target's size |
| void fge::View::setSize | ( | Vector2f const & | size | ) |
Set the size of the view.
A size smaller than the target will display a zoomed area, while a size greater than the target will show a bigger area.
| size | New size of the view |
| void fge::View::zoom | ( | float | factor | ) |
Helper function to zoom the view.
| factor | Zoom factor to apply to the view |