Trying to switch to more object-oriented

This commit is contained in:
2021-03-12 22:33:46 +01:00
parent fbe122a5b9
commit 258ce51cfe
32 changed files with 693 additions and 249 deletions
+6 -7
View File
@@ -5,6 +5,7 @@
#include "sdlpp_collision.hpp"
#include "sdlpp_renderer.hpp"
#include "sdlpp_texture.hpp"
#include "sdlpp_vector.hpp"
#include <memory>
#include <vector>
@@ -26,12 +27,12 @@ public:
virtual int collisionWidth() = 0;
virtual int collisionHeight() = 0;
virtual void specialAction( int code ) = 0;
virtual std::pair< std::pair< double, double >,
std::pair< double, double > >
virtual std::pair< Vec2D< double >, Vec2D< double > >
getDoubleRect() const = 0;
virtual void setPos( double x, double y );
virtual void setPos( const std::pair< double, double > &pos );
virtual std::pair< double, double > getPos() const;
virtual void setPos( const Vec2D<double> &vec );
virtual Vec2D< double > getPos() const;
bool colidesWith( const RenderObject &other ) const;
template < class T > void addCollision( const T &p ) {
collisions.push_back( std::make_shared< T >( p ) );
@@ -131,10 +132,8 @@ private:
friend Scene;
protected:
double og_x;
double og_y;
double x_;
double y_;
Vec2D< double > original;
Vec2D< double > current;
};
} // end of namespace SDLPP