begin implementing polymorphism

This commit is contained in:
churl
2021-04-08 03:18:12 +02:00
parent 055dfc5c9a
commit 0e780ff290
2 changed files with 31 additions and 0 deletions

20
src/object.hpp Normal file
View File

@ -0,0 +1,20 @@
#ifndef __OBJECT_H_
#define __OBJECT_H_
#include <SFML/Graphics.hpp>
class Object {
protected:
double x, y;
const unsigned short radius;
sf::CircleShape appearance;
protected:
Object(double x, double y, unsigned short radius);
public:
virtual bool collide(const Object& other);
};
#endif // __OBJECT_H_

11
src/umwelt.hpp Normal file
View File

@ -0,0 +1,11 @@
#ifndef __UMWELT_H_
#define __UMWELT_H_
#include <vector>
#include "object.hpp"
struct Umwelt {
std::vector<Object> objects;
};
#endif // __UMWELT_H_