equal
deleted
inserted
replaced
|
1 #ifndef GRAPHICS_MESSAGE_VIEW_HH |
|
2 #define GRAPHICS_MESSAGE_VIEW_HH |
|
3 |
|
4 #include "View.hh" |
|
5 |
|
6 #include <ClanLib/display.h> |
|
7 #include <string> |
|
8 #include <vector> |
|
9 |
|
10 namespace graphics |
|
11 { |
|
12 |
|
13 /** |
|
14 * Offset between consecutive lines |
|
15 */ |
|
16 const PixelDimension MESSAGE_VIEW_LINE_OFFSET = 5; |
|
17 |
|
18 struct Message { |
|
19 CL_Color color; |
|
20 std::string message; |
|
21 |
|
22 Message (CL_Color color, std::string message) : color(color), message(message) { } |
|
23 }; |
|
24 |
|
25 class MessageView : public View { |
|
26 protected: |
|
27 std::vector<Message> messages; |
|
28 |
|
29 public: |
|
30 /** |
|
31 * Define the area where messages are drawn |
|
32 */ |
|
33 MessageView (const PixelArea &area); |
|
34 |
|
35 /** |
|
36 * Add a message to the list of messages displayed |
|
37 */ |
|
38 void add_message (CL_Color color, std::string message); |
|
39 |
|
40 /** |
|
41 * Draw as many messages as fits |
|
42 */ |
|
43 virtual void draw (Display *display); |
|
44 }; |
|
45 |
|
46 } |
|
47 |
|
48 #endif |