summaryrefslogtreecommitdiff
path: root/src/object.h
blob: b29c3324a2084ab8d2b35755ffe1dd074cad4dad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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