summaryrefslogtreecommitdiff
path: root/src/object.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/object.h')
-rw-r--r--src/object.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/object.h b/src/object.h
new file mode 100644
index 0000000..b29c332
--- /dev/null
+++ b/src/object.h
@@ -0,0 +1,50 @@
+#ifndef OBJECT_H
+#define OBJECT_H
+
+#include "point.h"
+#include "velocity.h"
+#include "acceleration.h"
+#include <SFML/Graphics.hpp>
+
+class Object {
+ protected:
+ int width, height;
+ float angle;
+ Point point;
+ Velocity velocity;
+ Acceleration acceleration;
+ bool alive;
+ sf::Texture texture;
+ sf::Sprite sprite;
+ public:
+ Object();
+ Object(const Point &point);
+ Object(const Point &point, const Velocity &velocity);
+ Object(const Point &point, const Velocity &velocity, const Acceleration &acc);
+ void setAngle(const float angle);
+ void setWidth(const int width);
+ void setHeight(const int height);
+ void setPoint(const Point &point);
+ void setVelocity(const Velocity &velocity);
+ void setAcceleration(const Acceleration &acc);
+ void setAlive(const bool alive);
+ void setTexture(const sf::Texture &texture);
+ void setSprite(const sf::Sprite &sprite);
+ float getAngle();
+ int getWidth();
+ int getHeight();
+ Point getPoint();
+ Velocity getVelocity();
+ Acceleration getAcceleration();
+ bool getAlive();
+ sf::Texture getTexture();
+ sf::Sprite getSprite();
+ void kill();
+
+ virtual void update() {
+ this->velocity.update(this->acceleration);
+ this->point.update(this->velocity);
+ }
+ virtual void draw(sf::RenderWindow &window) = 0;
+};
+#endif