23 |
double operator[] (int idx); |
double operator[] (int idx); |
24 |
}; |
}; |
25 |
|
|
26 |
// class Drawable { |
typedef Uint32 PackedColor; |
|
// Uint32 map_color(int r, int g, int b); |
|
27 |
|
|
28 |
// void blit(int x, int y, Surface* s); |
class GS { |
29 |
// void blit(int x, int y, Surface* s, const Rect& r); |
GS (const Rect &clipr); |
30 |
|
~GS(); |
31 |
|
|
32 |
// void hline(int x, int y, int w, Uint32 color); |
Rect cliprect; |
33 |
// void vline(int x, int y, int h, Uint32 color); |
PackedColor pcolor; |
34 |
// void box(int x, int y, int w, int h, Uint32 color); |
}; |
35 |
// void line(int x1, int y1, int x2, int y2, Uint32 color); |
|
36 |
|
class Drawable { |
37 |
|
public: |
38 |
|
virtual ~Drawable() {} |
39 |
|
|
40 |
|
virtual PackedColor map_color(int r, int g, int b) = 0; |
41 |
|
virtual PackedColor map_color(int r, int g, int b, int a) = 0; |
42 |
|
|
43 |
|
virtual void blit (const GS &gs, int x, int y, Surface* s) = 0; |
44 |
|
virtual void blit (const GS &gs, int x, int y, Surface* s, const Rect& r) = 0; |
45 |
|
|
46 |
|
virtual Uint32 get_pixel (int x, int y) = 0; |
47 |
|
|
48 |
|
//! Set a single pixel |
49 |
|
virtual void set_pixel (const GS &gs, int x, int y) = 0; |
50 |
|
|
51 |
|
//! Set multiple pixels at once |
52 |
|
virtual void set_pixels (const GS &gs, int n, const int *x, const int *y); |
53 |
|
|
54 |
|
//! Draw a horizontal line |
55 |
|
virtual void hline (const GS &gs, int x, int y, int w); |
56 |
|
|
57 |
|
//! Draw a vertical line |
58 |
|
virtual void vline (const GS &gs, int x, int y, int h); |
59 |
|
|
60 |
|
//! Draw an arbitrary line |
61 |
|
virtual void line (const GS &gs, int x1, int y1, int x2, int y2); |
62 |
|
|
63 |
|
//! Draw a filled box. |
64 |
|
virtual void box (const GS &gs, int x, int y, int w, int h); |
65 |
|
|
66 |
|
//! Return size of drawable: Rect (0,0,width, height) |
67 |
|
virtual Rect size() const = 0; |
68 |
|
}; |
69 |
|
|
|
// Rect size(); |
|
|
// }; |
|
70 |
|
|
71 |
class Surface { |
class Surface : public Drawable { |
72 |
~Surface(); |
~Surface(); |
|
// void blit(int x, int y, Surface *s, const Rect &r); |
|
|
// void blit(int x, int y, Surface *s); |
|
73 |
|
|
|
Rect size(); |
|
74 |
int width(); |
int width(); |
75 |
int height(); |
int height(); |
76 |
}; |
}; |
77 |
|
|
78 |
class Screen : public Surface { |
class Screen { |
79 |
|
Surface *get_surface(); |
80 |
void update_all(); |
void update_all(); |
81 |
void update_rect(const Rect& r); |
void update_rect(const Rect& r); |
82 |
void flush_updates(); |
void flush_updates(); |