rendering

This commit is contained in:
2023-01-18 16:32:11 -08:00
parent e7ca641cbb
commit c1baadc755
7 changed files with 324 additions and 285 deletions

66
Pipe.h
View File

@@ -1,33 +1,33 @@
#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
//#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