42 lines
659 B
C++

#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
struct Vector2 {
float x;
float y;
};
struct Entity {
Vector2 position;
sf::RectangleShape shape;
float speed;
Vector2 direction;
Vector2 velocity;
virtual void update(sf::Time delta) = 0;
void set_position(Vector2 new_pos);
void set_size(Vector2 new_size);
};
struct Bat : public Entity {
bool moving_right = false;
bool moving_left = false;
void update(sf::Time delta) override;
};
enum Rebounds {
Sides,
Bat_Or_Top,
Bottom
};
struct Ball : public Entity {
void update(sf::Time delta) override;
void rebound(Rebounds rb);
};