Riyyi
10 years ago
11 changed files with 136 additions and 21 deletions
@ -0,0 +1,9 @@ |
|||||||
|
Book |
||||||
|
~~~~ |
||||||
|
|
||||||
|
Michael Dawson - Beginning C++ Through Game Programming, Third Edition - 2010 |
||||||
|
|
||||||
|
Video |
||||||
|
~~~~ |
||||||
|
|
||||||
|
https://www.youtube.com/user/geraldmcalister/videos |
@ -0,0 +1,21 @@ |
|||||||
|
#include "camera.h" |
||||||
|
|
||||||
|
Camera::Camera() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
Camera::~Camera() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
void Camera::SetNewView(sf::RenderWindow *window) { |
||||||
|
this->view = sf::View(sf::FloatRect(0, 0, 1280, 720)); |
||||||
|
window->setView(view); |
||||||
|
} |
||||||
|
|
||||||
|
void Camera::MoveCamera(sf::RenderWindow *window, sf::Vector2f move) { |
||||||
|
this->view.move(move.x, move.y); |
||||||
|
window->setView(view); |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
#ifndef CAMERA_H |
||||||
|
#define CAMERA_H |
||||||
|
|
||||||
|
#include <SFML/Graphics.hpp> |
||||||
|
|
||||||
|
class Camera |
||||||
|
{ |
||||||
|
public: |
||||||
|
Camera(); |
||||||
|
~Camera(); |
||||||
|
void SetNewView(sf::RenderWindow *window); |
||||||
|
void MoveCamera(sf::RenderWindow *window, sf::Vector2f move); |
||||||
|
|
||||||
|
private: |
||||||
|
//sf::Vector2f position;
|
||||||
|
sf::View view; |
||||||
|
}; |
||||||
|
|
||||||
|
#endif // CAMERA_H
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue