Camera.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Triangles
  3. * Copyright (C) 2016 POSITIVE MENTAL ATTITUDE
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, version 3 of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #pragma once
  18. #include <SFML/Graphics.hpp>
  19. /**
  20. * @class Camera
  21. * @author POSITIVE MENTAL ATTITUDE
  22. * @date 06/09/16
  23. * @file Camera.hpp
  24. * @brief A comfy wrapper around sf::View handling this Mario camera, or Twilight camera as I call it.
  25. */
  26. class Camera
  27. {
  28. public:
  29. Camera();
  30. void setTwilightViewport(const sf::Vector2f twilightViewport);
  31. void setTwilightViewport(float x, float y);
  32. void setSize(const sf::Vector2f size);
  33. void setSize(float x, float y);
  34. void setCenter(const sf::Vector2f center);
  35. void setCenter(float x, float y);
  36. void move(const sf::Vector2f& offset);
  37. void move(float offsetX, float offsetY);
  38. const sf::Vector2f getSize() const;
  39. const sf::Vector2f getCenter() const;
  40. const sf::View* getView() const;
  41. private:
  42. sf::Vector2f _offset;
  43. sf::Vector2f _twilightViewport;
  44. sf::View _view;
  45. };