![]() |
Gamedev Framework (gf)
0.10.0
A C++14 framework for 2D games
|
Fit view. More...
#include <gf/Views.h>
Public Member Functions | |
FitView () | |
Default constructor. More... | |
FitView (const RectF &rect) | |
Construct the view from a rectangle. More... | |
FitView (Vector2f center, Vector2f size) | |
Construct the view from its center and size. More... | |
virtual void | onScreenSizeChange (Vector2u screenSize) override |
Callback when the screen has just been resized. More... | |
![]() | |
AdaptativeView () | |
Default constructor. More... | |
AdaptativeView (const RectF &rect) | |
Construct the view from a rectangle. More... | |
AdaptativeView (Vector2f center, Vector2f size) | |
Construct the view from its center and size. More... | |
void | setInitialScreenSize (Vector2u screenSize) |
Set the initial screen size. More... | |
![]() | |
View () | |
Default constructor. More... | |
View (const RectF &rect) | |
Construct the view from a rectangle. More... | |
View (Vector2f center, Vector2f size) | |
Construct the view from its center and size. More... | |
virtual | ~View () |
Destructor. More... | |
RectF | getBounds () const |
Get the non-rotated bounds. More... | |
void | setCenter (Vector2f center) |
Set the center of the view. More... | |
Vector2f | getCenter () const |
Get the center of the view. More... | |
void | setSize (Vector2f size) |
Set the size of the view. More... | |
Vector2f | getSize () const |
Get the size of the view. More... | |
void | setRotation (float angle) |
Set the orientation of the view. More... | |
float | getRotation () const |
Get the current orientation of the view. More... | |
void | setViewport (const RectF &viewport) |
Set the target viewport. More... | |
const RectF & | getViewport () const |
Get the target viewport rectangle of the view. More... | |
void | reset (const RectF &rect) |
Reset the view to the given rectangle. More... | |
void | move (Vector2f offset) |
Move the view relatively to its current position. More... | |
void | rotate (float angle) |
Rotate the view relatively to its current orientation. More... | |
void | zoom (float factor) |
Resize the view rectangle relatively to its current size. More... | |
void | zoom (float factor, Vector2f fixed) |
Resize the view rectangle relatively to its current size and a fixed point. More... | |
Matrix3f | getTransform () const |
Get the projection transform of the view. More... | |
Matrix3f | getInverseTransform () const |
Get the inverse projection transform of the view. More... | |
Protected Member Functions | |
virtual void | onSizeChange (Vector2f size) override |
Callback when the world has just been resized. More... | |
virtual void | onViewportChange (const RectF &viewport) override |
Callback when the viewport has just been changed. More... | |
void | updateView () |
![]() | |
void | setSizeNoCallback (Vector2f size) |
Set the world size, without calling onSizeChange() More... | |
void | setViewportNoCallback (const RectF &viewport) |
Set the viewport, without calling onViewportChange() More... | |
Fit view.
This view will always maintain the aspect ratio of the world, while scaling it as much as possible to fit the screen. One disadvantage with this strategy is that there may appear black bars.
|
inline |
Default constructor.
This constructor creates a default view of \((0, 0, 1000, 1000)\).
|
inlineexplicit |
Construct the view from a rectangle.
rect | Rectangle defining the zone to display |
Construct the view from its center and size.
center | Center of the zone to display |
size | Size of the zone to display |
|
overridevirtual |
Callback when the screen has just been resized.
screenSize | The new size of the screen |
Implements gf::AdaptativeView.
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
Callback when the viewport has just been changed.
viewport | The new viewport |
Reimplemented from gf::View.
|
protected |