Pacman  1.0
Pacman game
Entity.h
Aller à la documentation de ce fichier.
1 #ifndef ENTITY_H
2 #define ENTITY_H
3 
4 #include "Maze.h"
5 #include "constants.h"
6 #include <SDL2/SDL.h>
7 #include <iostream>
8 #include <memory>
9 #include <vector>
10 
18 class Entity {
19  public:
20  Entity(float x, float y, int direction);
31  virtual void render(int frame, SDL_Renderer *renderer, SDL_Texture *texture) = 0;
32  void setDirection(int d);
33  float getX() const;
34  float getY() const;
35 
36  protected:
37  float x;
38  float y;
39  float speed;
40  int direction;
41  std::vector<SDL_Rect> sprites;
42  virtual SDL_Rect getSprite(int frame, int direction) = 0;
50  bool isAtIntersection(std::shared_ptr<Intersection> dest);
51 };
52 
53 #endif /* ENTITY_H */
Entity class.
Definition: Entity.h:18
Entity(float x, float y, int direction)
Definition: Entity.cpp:3
float getY() const
Definition: Entity.cpp:9
float speed
Definition: Entity.h:39
float getX() const
Definition: Entity.cpp:7
virtual void render(int frame, SDL_Renderer *renderer, SDL_Texture *texture)=0
render the entity
std::vector< SDL_Rect > sprites
Definition: Entity.h:41
virtual SDL_Rect getSprite(int frame, int direction)=0
bool isAtIntersection(std::shared_ptr< Intersection > dest)
return wether the entity is at an intersection
Definition: Entity.cpp:11
int direction
Definition: Entity.h:40
float x
Definition: Entity.h:37
float y
Definition: Entity.h:38
void setDirection(int d)
Definition: Entity.cpp:5