Adonthell  0.4
text_bubble.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2001 Kai Sterker <kai.sterker@gmail.com>
3  Copyright (C) 2001 Alexandre Courbot <alexandrecourbot@linuxgames.com>
4  Part of the Adonthell Project <http://adonthell.nongnu.org>
5 
6  Adonthell is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  Adonthell is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Adonthell. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 
21 /**
22  * @file text_bubble.h
23  * @author Kai Sterker <kai.sterker@gmail.com>
24  * @author Alexandre Courbot <alexandrecourbot@linuxgames.com>
25  *
26  * @brief Declares the text_bubble class.
27  *
28  *
29  */
30 
31 
32 #ifndef TEXT_BUBBLE_H_
33 #define TEXT_BUBBLE_H_
34 
35 #include "win_label.h"
36 #include "win_theme.h"
37 
38 
39 /**
40  * Displays neat little text speech bubbles.
41  *
42  * This class makes text bubbles designed to stay visible
43  * a short amount of time (just enough to be read).
44  *
45  */
46 class text_bubble : public win_label
47 {
48 public:
49  /**
50  * Constructor.
51  *
52  * @param text Text to display in that bubble.
53  * @param textcolor Font to use with this bubble (directly taken from the
54  * win_manager's font collection).
55  * @param themename Theme to use with this bubble (directly taken from the
56  * win_manager's theme collection).
57  * @param len Basic duration (in %game cycles) of this bubble. Another amount
58  * of time will be added, depending on it's length.
59  *
60  */
61  text_bubble (const string & text, const string & textcolor, const string & themename,
62  u_int16 len = 110);
63 
64  /**
65  * Destructor.
66  *
67  */
68  ~text_bubble ();
69 
70  /**
71  * Update function.
72  *
73  * @return \e false if the bubble should be destroyed now, \e true otherwise.
74  */
75  bool update ();
76 
77  /**
78  * Returns the number of game cycles remaining before the death of this
79  * bubble.
80  *
81  * @return Number of game cycles remaining before the death of this bubble.
82  */
84  {
85  return remain;
86  }
87 
88 private:
89  /**
90  * Game cycles remaining before the death of this bubble.
91  *
92  */
93  u_int16 remain;
94 };
95 
96 #endif
Displays neat little text speech bubbles.
Definition: text_bubble.h:46
u_int16 remaining()
Returns the number of game cycles remaining before the death of this bubble.
Definition: text_bubble.h:83
text_bubble(const string &text, const string &textcolor, const string &themename, u_int16 len=110)
Constructor.
Definition: text_bubble.cc:35
#define u_int16
16 bits long unsigned integer
Definition: types.h:38
bool update()
Update function.
Definition: text_bubble.cc:62
~text_bubble()
Destructor.
Definition: text_bubble.cc:58