original 1.0.1 release
[xwelltris.git] / src / include / wellsimpledraw.h
blobba85b78d406d1b59297cca7119ae2c1f27675739
1 #ifndef WELLSIMPLEDRAW_H
2 #define WELLSIMPLEDRAW_H
4 #include "bilist.h"
6 enum Canvas { screen=0, pixmap=1 };
8 struct WPoint
10 int x,y;
11 WPoint() { x=y=0;};
14 struct DirtyRect
16 int delta_x,delta_y; //here is the delta between dest screen and our dirty screen
17 int x,y;
18 unsigned int l,h;
19 DirtyRect() { x=y=delta_x=delta_y=0;l=h=0;};
20 DirtyRect(int dx, int dy,
21 int ix=0, int iy=0,
22 unsigned int il=0, unsigned int ih=0)
24 delta_x=dx; delta_y=dy;
25 x=ix; y=iy;
26 l=il; h=ih;
28 int get_src_x() { return x;};
29 int get_src_y() { return y;};
30 int get_dest_x() { return delta_x+x;};
31 int get_dest_y() { return delta_y+y;};
34 typedef bilist<DirtyRect> DirtyList;
36 class WellSimpleDraw
38 protected:
39 DirtyList dirty_list;
40 int max_x,max_y,min_x,min_y;
41 DirtyRect current_dirty;
42 int max_dirties;
44 public:
45 WellSimpleDraw();
46 ~WellSimpleDraw();
47 virtual void new_dirty_rec(int dx=0, int dy=0);
48 virtual void dirty_add_xy(int,int);
49 virtual void dirty_add_rec(DirtyRect);
50 virtual void finish_dirty_rec();
51 virtual void clear_dirty_list();
52 virtual void draw_line(int x1, int y1, int x2, int y2, int color_idx,
53 Canvas where=screen) {};
54 virtual void draw_rect(int x1, int y1, unsigned int il,
55 unsigned int ih, int color_idx,
56 Canvas where=screen) {};
57 virtual void fill_rect(int x1, int y1, unsigned int il,
58 unsigned int ih, int color_idx,
59 Canvas where=screen) {};
60 int get_max_dirties() { return max_dirties;};
63 #endif