| 1 |
/* |
| 2 |
* Support for non-overlapping floating text |
| 3 |
* Copyright (C) 2008 Douglas Boffey <DougABoffey@netscape.net> |
| 4 |
* |
| 5 |
* This file is part of The Mana World. |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef TEXTMANAGER_H |
| 23 |
#define TEXTMANAGER_H |
| 24 |
|
| 25 |
#include <list> |
| 26 |
|
| 27 |
#include "guichanfwd.h" |
| 28 |
|
| 29 |
class Text; |
| 30 |
|
| 31 |
class TextManager |
| 32 |
{ |
| 33 |
public: |
| 34 |
/** |
| 35 |
* Constructor |
| 36 |
*/ |
| 37 |
TextManager(); |
| 38 |
|
| 39 |
/** |
| 40 |
* Add text to the manager |
| 41 |
*/ |
| 42 |
void addText(Text *text); |
| 43 |
|
| 44 |
/** |
| 45 |
* Move the text around the screen |
| 46 |
*/ |
| 47 |
void moveText(Text *text, int x, int y); |
| 48 |
|
| 49 |
/** |
| 50 |
* Remove the text from the manager |
| 51 |
*/ |
| 52 |
void removeText(const Text *text); |
| 53 |
|
| 54 |
/** |
| 55 |
* Destroy the manager |
| 56 |
*/ |
| 57 |
~TextManager(); |
| 58 |
|
| 59 |
/** |
| 60 |
* Draw the text |
| 61 |
*/ |
| 62 |
void draw(gcn::Graphics *graphics, int xOff, int yOff); |
| 63 |
|
| 64 |
private: |
| 65 |
/** |
| 66 |
* Position the text so as to avoid conflict |
| 67 |
*/ |
| 68 |
void place(const Text *textObj, const Text *omit, |
| 69 |
int &x, int &y, int h); |
| 70 |
|
| 71 |
typedef std::list<Text *> TextList; /**< The container type */ |
| 72 |
TextList mTextList; /**< The container */ |
| 73 |
}; |
| 74 |
|
| 75 |
extern TextManager *textManager; |
| 76 |
|
| 77 |
#endif // TEXTMANAGER_H |