summaryrefslogtreecommitdiffstats
path: root/Renderer.h
blob: 0432fe51b4ef0bc5cbcedb67a07c19dd12f6b64e (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
#ifndef RENDERER_H_
#define RENDERER_H_

#include "Rectangle.h"
#include "Polygon.h"
#include "EditManager.h"
#include "Level.h"
#include "Room.h"
#include "PlayerStart.h"
#include "Portal.h"
#include "LevelEdge.h"


class Renderer {
  private:
    EditManager *editManager;
    
    void drawGrid(const Rectangle &rect, float scale);
    
  protected:
    void fillPolygon(const Polygon &polygon);
    void drawPolygon(const Polygon &polygon, bool close = true);
    void fillCircle(const Vertex &m, float r, int n = 64);
    void drawCircle(const Vertex &m, float r, int n = 64);
    void drawCircleDotted(const Vertex &m, float r, int n = 64, int d = 8, float rot = 0);
    void drawCross(const Vertex &m, float r);
    
    void renderObject(const LevelObject &object, bool selected, bool highlighted, float scale);
    
    void renderLevelVertex(const LevelVertex &vertex, bool selected, bool highlighted, float scale);
    void renderLevelEdge(const LevelEdge &edge, bool selected, bool highlighted, float scale);
    
    void renderRoom(const Room &room, bool selected, bool highlighted, float scale);
    void renderPlayerStart(const PlayerStart &start, bool selected, bool highlighted, float scale);
    void renderPortal(const Portal &portal, bool selected, bool highlighted, float scale);
    
  public:
    Renderer(EditManager *editManager) {
      this->editManager = editManager;
    }
    
    virtual ~Renderer() {}
    
    virtual void render(const Level &level, const Rectangle &rect, float scale);
};

#endif /*RENDERER_H_*/