Adonthell 0.4

text_bubble.h

Go to the documentation of this file.
00001 /*
00002    $Id: text_bubble.h,v 1.2 2001/08/31 15:34:10 gnurou Exp $
00003    
00004    Copyright (C) 2001 Kai Sterker <kaisterker@linuxgames.com>
00005    Copyright (C) 2001 Alexandre Courbot <alexandrecourbot@linuxgames.com>
00006    Part of the Adonthell Project http://adonthell.linuxgames.com
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 
00016 
00017 /**
00018  * @file   text_bubble.h
00019  * @author Kai Sterker <kaisterker@linuxgames.com>
00020  * @author Alexandre Courbot <alexandrecourbot@linuxgames.com>
00021  * 
00022  * @brief  Declares the text_bubble class.
00023  * 
00024  * 
00025  */
00026 
00027 
00028 #ifndef TEXT_BUBBLE_H_
00029 #define TEXT_BUBBLE_H_
00030 
00031 #include "win_label.h"
00032 #include "win_theme.h"
00033 
00034 
00035 /**
00036  * Displays neat little text speech bubbles.
00037  *
00038  * This class makes text bubbles designed to stay visible
00039  * a short amount of time (just enough to be read).
00040  *
00041  */ 
00042 class text_bubble : public win_label
00043 {
00044 public:
00045     /** 
00046      * Constructor.
00047      * 
00048      * @param text Text to display in that bubble.
00049      * @param textcolor Font to use with this bubble (directly taken from the
00050      *                  win_manager's font collection).
00051      * @param themename Theme to use with this bubble (directly taken from the
00052      *                  win_manager's theme collection).
00053      * @param len Basic duration (in %game cycles) of this bubble. Another amount
00054      *            of time will be added, depending on it's length.
00055      * 
00056      */
00057     text_bubble (const string & text, const string & textcolor, const string & themename,
00058                  u_int16 len = 110); 
00059 
00060     /**
00061      * Destructor.
00062      * 
00063      */ 
00064     ~text_bubble ();
00065 
00066     /**  
00067      * Update function.
00068      * 
00069      * @return \e false if the bubble should be destroyed now, \e true otherwise. 
00070      */
00071     bool update (); 
00072 
00073     /** 
00074      * Returns the number of game cycles remaining before the death of this
00075      * bubble. 
00076      * 
00077      * @return Number of game cycles remaining before the death of this bubble.
00078      */
00079     u_int16 remaining () 
00080     {
00081         return remain; 
00082     }
00083     
00084 private:
00085     /**
00086      * Game cycles remaining before the death of this bubble.
00087      * 
00088      */ 
00089     u_int16 remain; 
00090 }; 
00091 
00092 #endif