You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
848 B

2 years ago
#ifndef FLOPPY_BIRD_PIPE_H
#define FLOPPY_BIRD_PIPE_H
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <memory>
class Pipe : public sf::Drawable {
sf::Sprite pipe_top;
sf::Sprite pipe_shaft;
std::shared_ptr<sf::Texture> pipe_top_texture;
std::shared_ptr<sf::Texture> pipe_shaft_texture;
std::shared_ptr<sf::Shader> pipe_shaft_shader;
sf::Vector2f position;
float momentum;
public:
Pipe(float x, float y, std::shared_ptr<sf::Texture> pipe_top_texture, std::shared_ptr<sf::Texture> pipe_shaft_texture, std::shared_ptr<sf::Shader> shader);
void tick(float step, float speed);
bool collides(sf::FloatRect bounds);
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;
};
#endif //FLOPPY_BIRD_PIPE_H