From 0e780ff2901e3fb1c31480521932c4db1e48f954 Mon Sep 17 00:00:00 2001 From: churl Date: Thu, 8 Apr 2021 03:18:12 +0200 Subject: [PATCH] begin implementing polymorphism --- src/object.hpp | 20 ++++++++++++++++++++ src/umwelt.hpp | 11 +++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/object.hpp create mode 100644 src/umwelt.hpp diff --git a/src/object.hpp b/src/object.hpp new file mode 100644 index 0000000..01dd0d2 --- /dev/null +++ b/src/object.hpp @@ -0,0 +1,20 @@ +#ifndef __OBJECT_H_ +#define __OBJECT_H_ + +#include + +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_ diff --git a/src/umwelt.hpp b/src/umwelt.hpp new file mode 100644 index 0000000..ed371ae --- /dev/null +++ b/src/umwelt.hpp @@ -0,0 +1,11 @@ +#ifndef __UMWELT_H_ +#define __UMWELT_H_ + +#include +#include "object.hpp" + +struct Umwelt { + std::vector objects; +}; + +#endif // __UMWELT_H_