C++ Project 2016-2017: Arkanoid
entity.h
Go to the documentation of this file.
1 
3 #ifndef ENTITY_H
4 #define ENTITY_H
5 
6 #include "../math/vector2D.h"
7 
8 #include <iostream>
9 
10 using namespace std;
11 
12 namespace arkanoid {
13 
15  class Entity {
16  protected:
18  pair<double, double> size;
19 
20  public:
21 
27  Entity();
28 
38  Entity(double x, double y, pair<double, double> newSize = make_pair(1.0, 1.0));
39 
43  virtual ~Entity() {}
44 
48  virtual void update() = 0;
49 
53  virtual void draw() const = 0;
54 
60  Vector2D getPosition() const;
61 
68  void setPosition(double x, double y);
69 
75  void setPosition(const Vector2D &vector);
76 
82  void setSize(pair<double, double> newSize);
83 
89  pair<double, double> getSize() const;
90 
96  bool collidesWith(const Entity &other) const;
97 
98  };
99 
100 }
101 #endif /* ENTITY_H */
Vector2D position
The current position of the Entity (in the 9x7 grid).
Definition: entity.h:17
Representation of a vector.
Definition: vector2D.h:14
virtual ~Entity()
Definition: entity.h:43
All the game logic of the Arkanoid game.
Definition: ball.cpp:15
An Entity represents an "object" (like Player, Ball, Block, ...) in the game World.
Definition: entity.h:15
pair< double, double > size
The size (width and height respectively) of the Entity.
Definition: entity.h:18