Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglTextSet.hpp

00001 /*****************************************************************************
00002  * SGL: A Scene Graph Library
00003  *
00004  * Copyright (C) 1997-2001  Scott McMillan   All Rights Reserved.
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the Free
00018  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  *****************************************************************************
00020  *     File: sglTextSet.hpp
00021  *  Created: 11 September 2001
00022  *  Summary: render 2D bitmapped text in a 3D location in the scene
00023  *****************************************************************************/
00024 
00025 #ifndef __SGL_TEXTSET_HPP
00026 #define __SGL_TEXTSET_HPP
00027 
00028 #include <sgl.h>
00029 #include <sglDrawable.hpp>
00030 #include <sglBitmapFont.hpp>
00031 
00032 //============================================================================
00033 
00073 class SGL_DLL_API sglTextSet : public sglDrawable
00074 {
00075 public:
00077    sglTextSet();
00078 
00080    virtual ~sglTextSet();
00081 
00082    // --------------- Functions specific to this drawable ----------------
00086    void setString(const string &str);
00087 
00091    const string &getString() const { return m_text; }
00092 
00097    void setFont(sglBitmapFont *font);
00098 
00102    sglBitmapFont *getFont() const { return m_font; }
00103 
00104 
00108    void setColor(const sglVec4f &color);
00109 
00116    void setColor(float r, float g, float b, float a);
00117 
00121    const sglVec4f &getColor() const { return m_color; }
00122 
00126    void setPosition(const sglVec3f &pos);
00127 
00133    void setPosition(float x, float y, float z);
00134 
00138    const sglVec3f &getPosition() const { return m_position; }
00139 
00140    // ---------------- Functions required by sglDrawable -----------------
00141    // Add this drawable's stats to the given debug_stats.
00142    virtual void addStats(sglStats &stats) const { stats.addText(1); }
00143 
00144    virtual void drawGeometry(const vector<sglTexCoords> &) const;
00145    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00146 
00147 protected:
00148    virtual bool computeBounds();
00149 
00150 private: // not implemented
00151    sglTextSet(const sglTextSet &);
00152    sglTextSet &operator=(const sglTextSet &);
00153 
00154 private:
00155    sglVec3f             m_position;
00156    sglVec4f             m_color;
00157    string               m_text;
00158 
00159    sglBitmapFont       *m_font;
00160 
00161    sglTransparency      m_transparency_statelet;
00162    vector<sglStatelet*> m_statelets;
00163 };
00164 
00165 #endif

Generated at Mon Jul 1 18:00:06 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001