Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hud.h
Go to the documentation of this file.
1 /*
2  * Vega Strike
3  * Copyright (C) 2001-2002 Daniel Horn & Alan Shieh
4  *
5  * http://vegastrike.sourceforge.net/
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) 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 __HUD_H
23 #define __HUD_H
24 
25 #include <string>
26 #include "vec.h"
27 #include "gfxlib_struct.h"
28 class Texture;
29 
30 class TextPlane
31 {
32  std::string myText;
33 
34 //Texture *myFont;
35  Vector myFontMetrics; //i = width, j = height
36  Vector myDims;
37  int numlet;
38 /*
39  * struct GlyphPosition {
40  * float left, right, top, bottom;
41  * } myGlyphPos[256];
42  */
43 public:
45  TextPlane( const struct GFXColor &col = GFXColor( 1, 1, 1, 1 ), const struct GFXColor &bgcol = GFXColor( 0, 0, 0, 0 ) );
46  ~TextPlane();
47  void SetPos( float x, float y )
48  {
49  myFontMetrics.k = y;
50  myDims.k = x;
51  }
52  void SetCharSize( float x, float y )
53  {
54  myFontMetrics.i = x;
55  myFontMetrics.j = y;
56  }
57  void GetCharSize( float &x, float &y )
58  {
59  x = myFontMetrics.i;
60  y = myFontMetrics.j;
61  }
62  void GetPos( float &y, float &x )
63  {
64  y = myFontMetrics.k;
65  x = myDims.k;
66  }
67  void SetSize( float x, float y )
68  {
69  myDims.i = x;
70  myDims.j = y;
71  }
72  void GetSize( float &x, float &y )
73  {
74  x = myDims.i;
75  y = myDims.j;
76  }
77  int Draw( int offset = 0 ); //returns number of lines
78  int Draw( const std::string &text,
79  int offset = 0,
80  bool start_one_line_lower = false,
81  bool force_highquality = false,
82  bool automatte = false );
83  void SetText( const std::string &newText )
84  {
85  myText = newText;
86  }
87  std::string GetText() const
88  {
89  return myText;
90  }
91 };
92 
93 #endif
94