1 #ifndef INC_GFX_H
2 #define INC_GFX_H
3 
4 #include <SDL/SDL.h>
5 
6 #include "coords.h"
7 
8 struct View
9 {
10     CartCoord centre;
11     float zoom;
12     float angle;
13 
ViewView14     View() {}
15     View(CartCoord icentre, float izoom=1, float iangle=0);
16 
17     ScreenCoord coord(const CartCoord &c) const;
18     bool inView(const CartCoord &c, float in=0) const;
19 };
20 
21 struct Line
22 {
23     CartCoord start;
24     CartCoord end;
25     Uint32 colour;
26 
27     Line(CartCoord istart, CartCoord iend, Uint32 icolour=0xffffffff) :
startLine28 	start(istart),end(iend),colour(icolour) {}
29 
30     int draw(SDL_Surface* surface, const View& view, View* boundView=NULL,
31 	bool noAA=false);
32 };
33 
34 struct Circle
35 {
36     CartCoord centre;
37     float r;
38     Uint32 colour;
39     bool filled;
40 
41     Circle(CartCoord icentre, float ir, Uint32 icolour=0xffffffff,
42 	    bool ifilled=false) :
centreCircle43 	centre(icentre), r(ir), colour(icolour), filled(ifilled)
44     {}
45 
46     int draw(SDL_Surface* surface, const View& view, View* boundView=NULL,
47 	bool noAA=false);
48 };
49 
50 struct Polygon
51 {
52     CartCoord* points;
53     int n;
54     Uint32 colour;
55     bool filled;
56 
57     Polygon(CartCoord* ipoints, int in, Uint32 icolour=0xffffffff,
58 	    bool ifilled=false) :
pointsPolygon59 	points(ipoints), n(in), colour(icolour), filled(ifilled)
60     {}
61 
62     int draw(SDL_Surface* surface, const View& view, View* boundView=NULL,
63 	bool noAA=false);
64 };
65 
66 struct Pixel
67 {
68     CartCoord point;
69     Uint32 colour;
70     Pixel(CartCoord point, Uint32 colour=0xffffffff) :
pointPixel71 	point(point), colour(colour)
72     {}
73 
74     int draw(SDL_Surface* surface, const View& view, View* boundView=NULL,
75 	bool noAA=false);
76 };
77 
78 #endif /* INC_GFX_H */
79