author | Tero Marttila <terom@fixme.fi> |
Wed, 21 Jan 2009 23:07:22 +0200 | |
branch | new_graphics |
changeset 412 | 721c60072091 |
parent 411 | 106aaf6eadfe |
permissions | -rw-r--r-- |
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
1 |
#ifndef GRAPHICS_MESSAGE_VIEW_HH |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
2 |
#define GRAPHICS_MESSAGE_VIEW_HH |
393
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
|
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
4 |
#include "View.hh" |
393
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
5 |
|
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
6 |
#include <ClanLib/display.h> |
393
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
#include <string> |
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
#include <vector> |
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
9 |
|
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
10 |
namespace graphics |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
11 |
{ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
12 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
13 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
14 |
* Offset between consecutive lines |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
15 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
16 |
const PixelDimension MESSAGE_VIEW_LINE_OFFSET = 5; |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
17 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
18 |
struct Message { |
393
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
19 |
CL_Color color; |
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
20 |
std::string message; |
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
21 |
|
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
22 |
Message (CL_Color color, std::string message) : color(color), message(message) { } |
393
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
23 |
}; |
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
24 |
|
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
25 |
class MessageView : public View { |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
26 |
protected: |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
27 |
std::vector<Message> messages; |
393
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
28 |
|
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
29 |
public: |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
30 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
31 |
* Define the area where messages are drawn |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
32 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
33 |
MessageView (const PixelArea &area); |
394
82def222fe7d
try and implement resize in a sane way, but changeing from windowed mode to fullscreen mode is now kind of weird
Tero Marttila <terom@fixme.fi>
parents:
393
diff
changeset
|
34 |
|
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
35 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
36 |
* Add a message to the list of messages displayed |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
37 |
*/ |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
38 |
void add_message (CL_Color color, std::string message); |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
39 |
|
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
40 |
/** |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
41 |
* Draw as many messages as fits |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
42 |
*/ |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
43 |
virtual void draw (Display &display); |
393
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
44 |
}; |
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
45 |
|
411
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
46 |
} |
106aaf6eadfe
there's a grain of truth in the new graphics code now...
Tero Marttila <terom@fixme.fi>
parents:
394
diff
changeset
|
47 |
|
393
5dd4d782cf3a
a basic implementation of game messages, plus some weird GameStateEvent stuff
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
48 |
#endif |