Slippers Engine
 
Loading...
Searching...
No Matches
Camera

Examples for Camera use. More...

Classes

class  CameraManager
 Responsible for the current Camera and Camera2D. For functions go to Scene. More...
 

Detailed Description

Examples for Camera use.

Example:

camPersp = new Camera(Camera::Type::PERSPECTIVE_3D);
camPersp->setViewport(0, 0, Game::GetWidth(), Game::GetHeight());
camPersp->setPerspective(35.0f, float(Game::GetWidth()) / float(Game::GetHeight()), 1.0f, 5000.0f);
// Orient Camera
Vect upPerspCam(0.0f, 1.0f, 0.0f);
Vect posPerspCam(50.0f, 50.0f, 150.0f);
Vect lookAtPerspCam(0.0f, 0.0f, 0.0f);
camPersp->setOrientAndPosition(upPerspCam, lookAtPerspCam, posPerspCam);
camPersp->updateCamera();
camOrtho = new Camera(Camera::Type::ORTHOGRAPHIC_2D);
assert(cam2D);
camOrtho->setViewport(0, 0, Game::GetWidth(), Game::GetHeight());
camOrtho->setOrthographic(-0.5f * Game::GetWidth(), 0.5f * Game::GetWidth(),
-0.5f * Game::GetHeight(), 0.5f * Game::GetHeight(),
1.0f, 1000.0f);
// Orient Camera
Vect upOrthoCam(0.0f, 1.0f, 0.0f);
Vect posOrthoCam(0.0f, 0.0f, 0.0f);
Vect lookAtOrthoCam(0.0f, 0.0f, -1.0f);
camOrtho->setOrientAndPosition(upOrthoCam, lookAtOrthoCam, posOrthoCam);
camOrtho->updateCamera();
static int GetHeight()
Returns window's height in pixels.
Definition Game.h:161
static int GetWidth()
Returns window's width in pixels.
Definition Game.h:167