| MyGL
    | 
Class used to manipulate a 2D camera. More...
#include <Camera.hpp>
| Public Member Functions | |
| MYGL_EXPORT | Camera () noexcept | 
| Default constructor, creates a camera pointing to the center of the window. | |
| MYGL_EXPORT | Camera (int x, int y) noexcept | 
| Creates a 2D camera with its bottom left hand corner coordinates. | |
| MYGL_EXPORT void | setPosition (int x, int y) noexcept | 
| Sets the camera's position. | |
| MYGL_EXPORT glm::vec2 | getPosition () const noexcept | 
| Get the camera's current position. | |
| MYGL_EXPORT void | setSpeed (float speed) noexcept | 
| Sets the camera's speed, in pixels per second. | |
| MYGL_EXPORT float | getSpeed () const noexcept | 
| Get the camera's speed. | |
| MYGL_EXPORT glm::mat4 | lookAt () const | 
| Returns the camera's "look_at" matrix, it is used internally by a Window to set its view when drawing things. | |
| Functions related to the camera's movement | |
| These functions all have a common parameter (float frametime), this parameter represents the frametime, it is needed in order to move the camera at a constant speed (speed which is expressed in pixels / second and defined with a call to setSpeed(float)), the speed would then be independent from the framerate. You can get the frametime with a call to the getFrametime() function of the current Window, for example :  ++ my::Window window(800, 600, "window"); my::Camera camera(0, 0); camera.setSpeed(50.0f); window.setCamera(camera); ... float frametime; bool running = true; while(window.isRunning()) {   ...   window.clear(...);   frametime = window.getFrametime();   camera.moveUp(frametime);   ...   window.display() } | |
| MYGL_EXPORT void | moveUp (float frametime) noexcept | 
| Moves the camera upwards. | |
| MYGL_EXPORT void | moveDown (float frametime) noexcept | 
| Moves the camera downwards. | |
| MYGL_EXPORT void | moveLeft (float frametime) noexcept | 
| Moves the camera to the left. | |
| MYGL_EXPORT void | moveRight (float frametime) noexcept | 
| Moves the camera to the right. | |
Class used to manipulate a 2D camera.
Definition at line 14 of file Camera.hpp.
| 
 | noexcept | 
Creates a 2D camera with its bottom left hand corner coordinates.
| x | The camera's x coordinate | 
| y | The camera's y coordinate | 
| 
 | noexcept | 
Get the camera's current position.
| 
 | noexcept | 
Get the camera's speed.
| MYGL_EXPORT glm::mat4 lookAt | ( | ) | const | 
Returns the camera's "look_at" matrix, it is used internally by a Window to set its view when drawing things.
| 
 | noexcept | 
Sets the camera's position.
| x | The x coordinate of the bottom left hand corner | 
| y | The y coordinate of the bottom left hand corner | 
| 
 | noexcept | 
Sets the camera's speed, in pixels per second.
| speed | The camera's speed, used with the frametime to produce fluid movements |