Arch Game Engine  0.2
level.h
1 #ifndef LEVEL_H
2 #define LEVEL_H
3 
4 #include <vector>
5 #include "stage.h"
6 #include "entity.h"
7 #include "collision.h"
8 
10 class Level {
11 private:
12  Stage stage;
13  vector< vector<Tile> > tiles;
14  vector<Object> objects;
15  vector<Entity> entities;
16  double x, y;
17  int tilewidth, tileheight;
18  Object screen;
19  Collision col;
20  bool precise;
21  int mainEntityID;
22  bool mainEntitySet;
23  Object camera, lens;
24  bool activeCam, activeLens;
25 public:
26  Level();
27  ~Level();
29  void create();
31  void setStage(Stage s) { stage = s; }
33  void setStage(Map m, Tileset t) { stage.setMap(m); stage.setTileset(t); }
35  void setScale(int w, int h);
37  void setScale(int s) { setScale(s, s); }
39  void calcPos();
41  vector<Tile> getTilesToRender();
43  vector<Object> getObjectsToRender();
45  vector<Entity> getEntitiesToRender();
47  void move(int mx, int my);
48  void moveEntity(int id, int mx, int my);
50  void setCoord(double x, double y) { setX(x); setY(y); screen.setPosCoord(getX(), getY()); }
52  void setX(double x) { this->x = x; }
54  void setY(double y) { this->y = y; }
56  double getX() const { return x; }
58  double getY() const { return y; }
59  Object getScreen() const { return screen; }
61  void setScreenSize(int w, int h) { screen.setPosSize(w, h); }
63  void setPrecise(bool p) { precise = p; }
65  void addObject(Object o);
67  void addObject(vector<Object> o);
69  int addEntity(Entity e);
71  void addEntity(vector<Entity> e);
73  int setMainEntity(Entity e);
75  int setMainEntity(int m);
76  void setCameraMargin(int wm, int hm);
77  void centerCamera(int percentage);
78  void setLensMargin(int wn, int hm);
79  void centerLens(int percentage);
80  Object getCamera();
81  Object getLens();
82 };
83 
84 #endif //LEVEL_H
This class stores information for an Object in the game.
Definition: object.h:12
Class for loading in multiple Tiles.
Definition: tileset.h:8
void create()
Create the Level based on the given stage.
Definition: level.cpp:11
int setMainEntity(Entity e)
Set main Entity.
Definition: level.cpp:132
vector< Object > getObjectsToRender()
Return the Objects that are currently on the screen.
Definition: level.cpp:89
double getY() const
Get the y coordinate.
Definition: level.h:58
double getX() const
Get the x coordinate.
Definition: level.h:56
The Stage class stores a Map and Tileset.
Definition: stage.h:8
void setStage(Map m, Tileset t)
Create a Stage for the Level by giving a Map and a Tileset.
Definition: level.h:33
int addEntity(Entity e)
Add Entity to Level.
Definition: level.cpp:124
vector< Entity > getEntitiesToRender()
Return the Entities that are currently on the screen.
Definition: level.cpp:103
void setY(double y)
Set the y coordinate.
Definition: level.h:54
void setX(double x)
Set the x coordinate.
Definition: level.h:52
vector< Tile > getTilesToRender()
Return the Tiles that are currently on the screen.
Definition: level.cpp:73
void setCoord(double x, double y)
Set the coordinate for the screen with a given x and y.
Definition: level.h:50
void addObject(Object o)
Add Object to Level.
Definition: level.cpp:117
Class for storing health, emotion, team, etc. of an Object.
Definition: entity.h:9
void setScale(int w, int h)
Scale the Level by giving it the width and height to scale by.
Definition: level.cpp:15
This class stores a Stage and Objects and can move them and display them.
Definition: level.h:10
void setScale(int s)
Scale the Level by giving it a single integer to scale by.
Definition: level.h:37
This class takes in a file and loads it in for the map.
Definition: map.h:10
void move(int mx, int my)
Move the screen by passing in how much to move on the x and y coordinates.
Definition: level.cpp:39
Class used for calculating different types of collision between given Objects.
Definition: collision.h:7
void setStage(Stage s)
Give a Stage to the Level.
Definition: level.h:31
void calcPos()
Calculate the position of the level based on coordinates.
void setMap(Map m)
Set the Map by passing in a Map.
Definition: stage.h:23
void setScreenSize(int w, int h)
Set the size of the screen by passing in the width and height.
Definition: level.h:61
void setTileset(Tileset t)
Set the Tileset with a given Tileset.
Definition: stage.h:29
void setPrecise(bool p)
Active precise if you want the coordinates in a map file to go to that exact pixel, or leave it off if you want it to go to that Tile.
Definition: level.h:63