hx3d
1
2D/3D Simple Game Framework
|
#include <viewport.hpp>
Public Member Functions | |
void | setScreenPosition (const float x, const float y) |
Set the viewport position. More... | |
void | apply (Camera &camera) |
Apply the viewport on the screen, centering the camera. More... | |
void | update (Camera &camera, const int screenWidth, const int screenHeight) |
Update the viewport with a new screen width and height, centering the camera. More... | |
glm::vec2 | screenToWorld (const glm::vec2 screenPoint) |
Convert a screen point to a world point. More... | |
glm::vec2 | getWorldSize () |
Get the world size. | |
Protected Member Functions | |
virtual void | internalUpdate (Camera &camera)=0 |
Update the viewport, centering the camera (internal). | |
Protected Attributes | |
float | _worldWidth |
World width. | |
float | _worldHeight |
World height. | |
int | _screenX |
X offset. | |
int | _screenY |
Y offset. | |
int | _screenWidth |
Screen width. | |
int | _screenHeight |
Screen height. | |
Camera viewport.
Definition at line 46 of file viewport.hpp.
void hx3d::graphics::viewports::Viewport::apply | ( | Camera & | camera | ) |
Apply the viewport on the screen, centering the camera.
camera | Camera |
Definition at line 42 of file viewport.cpp.
glm::vec2 hx3d::graphics::viewports::Viewport::screenToWorld | ( | const glm::vec2 | screenPoint | ) |
Convert a screen point to a world point.
screenPoint | Screen point |
Definition at line 61 of file viewport.cpp.
void hx3d::graphics::viewports::Viewport::setScreenPosition | ( | const float | x, |
const float | y | ||
) |
Set the viewport position.
x | X coordinate |
y | Y coordinate |
Definition at line 37 of file viewport.cpp.
void hx3d::graphics::viewports::Viewport::update | ( | Camera & | camera, |
const int | screenWidth, | ||
const int | screenHeight | ||
) |
Update the viewport with a new screen width and height, centering the camera.
camera | Camera |
screenWidth | New width |
screenHeight | New height |
Definition at line 54 of file viewport.cpp.