diff options
author | Nao Pross <naopross@thearcway.org> | 2019-01-25 01:11:57 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2019-01-25 01:11:57 +0100 |
commit | bcd14a356cafe58808b4c2a14782ebb194c6abc5 (patch) | |
tree | 3bc95288b0a0172bb447ccf218fb59821f22501a /engine/include/bound.hpp | |
parent | Delete bin and test/makefile update .gitignore (diff) | |
download | flatland-bcd14a356cafe58808b4c2a14782ebb194c6abc5.tar.gz flatland-bcd14a356cafe58808b4c2a14782ebb194c6abc5.zip |
Rename everything under engine/ to remove `flat' and be `.hpp'
Diffstat (limited to 'engine/include/bound.hpp')
-rw-r--r-- | engine/include/bound.hpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/engine/include/bound.hpp b/engine/include/bound.hpp new file mode 100644 index 0000000..f5a2c0d --- /dev/null +++ b/engine/include/bound.hpp @@ -0,0 +1,38 @@ +#ifndef __FLATBOUND_H__ +#define __FLATBOUND_H__ + +#include "object.hpp" +#include "svector.h" + +typedef SVector<int, 2> pixel; + +class FlatBound : virtual public flat::core::object +{ + pixel location; + +public: + + FlatBound() {} + virtual ~FlatBound() {} + + virtual void scale(double ratio) = 0; + + virtual pixel extremum(const FlatBound*) const = 0; + + bool isColliding(const FlatBound *other) const + { + return (other.extremum(this) - location) < (this.extremum(other) - location); + } + + const pixel& getLocation() const + { + return location; + } + + void setLocation(const pixel &loc) + { + this->location = loc; + } +}; + +#endif |