hx3d  1
2D/3D Simple Game Framework
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
hx3d::graphics::viewports::Viewport Class Referenceabstract

Camera viewport. More...

#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.
 

Detailed Description

Camera viewport.

Definition at line 46 of file viewport.hpp.

Member Function Documentation

void hx3d::graphics::viewports::Viewport::apply ( Camera camera)

Apply the viewport on the screen, centering the camera.

Parameters
cameraCamera

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.

Parameters
screenPointScreen point
Returns
World 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.

Parameters
xX coordinate
yY 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.

Parameters
cameraCamera
screenWidthNew width
screenHeightNew height

Definition at line 54 of file viewport.cpp.


The documentation for this class was generated from the following files: