#include <statuspanel.h>
Inheritance diagram for StatusPanel:
Public Methods | |
StatusPanel () | |
Basic constructor. More... | |
StatusPanel (const unsigned int x, const unsigned int y, const unsigned int w, const unsigned int h) | |
Constructor. More... | |
virtual | ~StatusPanel () |
Destructor. | |
StatusPanel & | operator= (StatusPanel const &other) |
Assignment operator. | |
bool | draw (SDL_Surface *screen, Player *player) |
Draws the status panel. More... | |
void | addMessage (string const &message, const Uint32 color) |
Add a message to the list of messages to draw. More... | |
void | updateCurrentText (string const &text) |
Update the current text. More... | |
virtual void | setFont (TTF_Font *font) |
void | setNeedToDraw (bool value) |
Static Public Attributes | |
const string | STATUS_BITMAP_FILE = string("statuspanel.bmp") |
Name of the file with the background bitmap. | |
const unsigned int | INFO_BOX_WIDTH = 454 |
const unsigned int | INFO_BOX_HEIGHT = 112 |
Private Methods | |
void | drawInfoBox (SDL_Surface *screen) |
Aux function to draw the info/chat box. More... | |
Private Attributes | |
deque< pair< string, Uint32 > > | messages |
List of messages. More... | |
string | currentText |
Current text. More... | |
bool | needToDraw |
Do we need to draw?. More... | |
unsigned int | lines |
int | resources [NUMRESOURCES] |
This class is used to draws the bottom part of the screen
where several status information is displayed. On the left
there is a list of resources and their amounts and on the
right there is a chat and info area.
|
Basic constructor. This constructor does not do anything useful. Probably you shouldn't never use this one |
|
Constructor. This constructor creates a surface for this panel with the given dimensions and the format of the screen surface. Important: you can not call this constructor before initializing the video because it need to access to the screen surface with SDL_GetVideoSurface().
|
|
Add a message to the list of messages to draw. Add a pair of message and color to the list of messages to draw.
|
|
Draws the status panel. Draws the status panel displaying the resources on the left and a box with the messages on the right
|
|
Aux function to draw the info/chat box. Draw the background and then as many messages as they fit in the box. First drawing the new ones and then the old ones.
|
|
Update the current text. Update the text in the editing line that the user uses to enter text for the chat.
|
|
Current text. The text in the edit line |
|
List of messages. each element is a pair of text and color. This is a double ended queue but it is used as a regular queue with iterator capabilities. |
|
Do we need to draw?. With this simple variable we get some more fps by redrawing this part of the screen only if we have to do it. |