raycaster/camera.hpp

30 lines
822 B
C++

#pragma once
#include "components.hpp"
#include <SFML/Graphics/RenderTexture.hpp>
namespace cinematic {
struct Camera {
components::Animation anim;
sf::Vector2f size{SCREEN_WIDTH, SCREEN_HEIGHT};
sf::Vector2f base_size{SCREEN_WIDTH, SCREEN_HEIGHT};
sf::Vector2f aimed_at{0,0};
sf::Vector2f going_to{0,0};
sf::FloatRect camera_bounds{{0,0},{SCREEN_WIDTH, SCREEN_HEIGHT}};
sf::View view;
Camera(sf::Vector2f base_size);
void resize(float width);
void scale(float ratio);
void position(float x, float y);
void move(float x, float y);
bool playing();
void render(sf::RenderTexture& target);
void play();
void style(const std::string &name);
void reset(sf::RenderTexture& target);
void update_camera_bounds(sf::Vector2f size);
};
void init();
}