]> git.localhorst.tv Git - gworm.git/blob - src/graphics/Canvas.h
b464dd66a50a29a5952ec67160a573aba7a7bb14
[gworm.git] / src / graphics / Canvas.h
1 #ifndef GWORM_CANVAS_H_
2 #define GWORM_CANVAS_H_
3
4 #include "Color.h"
5 #include "Vector.h"
6
7 #include <SDL.h>
8
9
10 namespace gworm {
11
12 class Canvas {
13
14 public:
15         Canvas() : canv(nullptr) { }
16         Canvas(SDL_Window *win, int index, Uint32 flags);
17         ~Canvas();
18
19         Canvas(Canvas &&);
20         Canvas &operator =(Canvas &&);
21
22         Canvas(const Canvas &) = delete;
23         Canvas &operator =(const Canvas &) = delete;
24
25 public:
26         Vector<int> Size() const;
27
28         void Present();
29
30         void SetColor(Color);
31
32         void Fill();
33         void Outline();
34
35         void Line(Vector<int> from, Vector<int> to);
36         void FillRect(Vector<int> pos, Vector<int> size);
37         void OutlineRect(Vector<int> pos, Vector<int> size);
38
39         void Dot(Vector<int> pos);
40         void Cross(Vector<int> pos, int extent);
41         void Arrow(Vector<int> from, Vector<int> to);
42         void Triangle(Vector<int>, Vector<int>, Vector<int>);
43         void Quad(Vector<int>, Vector<int>, Vector<int>, Vector<int>);
44
45         void Grid(Vector<int> pos, Vector<int> size, Vector<int> step);
46         void Grid(Vector<int> pos, Vector<int> size, Vector<float> step);
47
48         void Grid2(Vector<int> pos, Vector<int> size, Vector<int> step,
49                         Vector<int> n, Color, Color);
50         void Grid2(Vector<int> pos, Vector<int> size, Vector<float> step,
51                         Vector<int> n, Color, Color);
52
53 private:
54         SDL_Renderer *canv;
55
56 };
57
58 }
59
60 #endif