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
BaseInterface::Room::BaseText Class Reference

#include <base.h>

Inheritance diagram for BaseInterface::Room::BaseText:
BaseInterface::Room::BaseObj

Public Member Functions

virtual void Draw (::BaseInterface *base)
 
virtual ~BaseText ()
 
 BaseText (const std::string &texts, float posx, float posy, float wid, float hei, float charsizemult, GFXColor backcol, GFXColor forecol, const std::string &ind)
 
void SetText (const std::string &newtext)
 
void SetPos (float posx, float posy)
 
void SetSize (float wid, float hei)
 
- Public Member Functions inherited from BaseInterface::Room::BaseObj
virtual ~BaseObj ()
 
 BaseObj (const std::string &ind)
 

Public Attributes

TextPlane text
 
- Public Attributes inherited from BaseInterface::Room::BaseObj
const std::string index
 

Detailed Description

Definition at line 169 of file base.h.

Constructor & Destructor Documentation

virtual BaseInterface::Room::BaseText::~BaseText ( )
inlinevirtual

Definition at line 177 of file base.h.

177 {}
BaseInterface::Room::BaseText::BaseText ( const std::string &  texts,
float  posx,
float  posy,
float  wid,
float  hei,
float  charsizemult,
GFXColor  backcol,
GFXColor  forecol,
const std::string &  ind 
)
inline

Definition at line 178 of file base.h.

References TextPlane::GetCharSize(), TextPlane::SetCharSize(), TextPlane::SetPos(), TextPlane::SetSize(), TextPlane::SetText(), and text.

186  : BaseObj( ind )
187  , text( forecol, backcol )
188  {
189  text.SetPos( posx, posy );
190  text.SetSize( wid, hei );
191  float cx = 0, cy = 0;
192  text.GetCharSize( cx, cy );
193  cx *= charsizemult;
194  cy *= charsizemult;
195  text.SetCharSize( cx, cy );
196  text.SetText( texts );
197  }

Member Function Documentation

void BaseInterface::Room::BaseText::Draw ( ::BaseInterface base)
virtual

Reimplemented from BaseInterface::Room::BaseObj.

Definition at line 508 of file base_interface.cpp.

References f, g_game, VegaConfig::getVariable(), GFXBegin(), GFXColorf(), GFXEnd(), GFXQUAD, GFXVertex3f(), XMLSupport::parse_float(), XMLSupport::parse_int(), vs_config, game_data_t::x_resolution, and game_data_t::y_resolution.

509 {
510  int tmpx = g_game.x_resolution;
511  int tmpy = g_game.y_resolution;
512  static int base_max_width = XMLSupport::parse_int( vs_config->getVariable( "graphics", "base_max_width", "0" ) );
513  static int base_max_height = XMLSupport::parse_int( vs_config->getVariable( "graphics", "base_max_height", "0" ) );
514  if (base_max_width && base_max_height) {
515  if (base_max_width < tmpx)
516  g_game.x_resolution = base_max_width;
517  if (base_max_height < tmpy)
518  g_game.y_resolution = base_max_height;
519  }
520  static float base_text_background_alpha =
521  XMLSupport::parse_float( vs_config->getVariable( "graphics", "base_text_background_alpha", "0.0625" ) );
522  GFXColor tmpbg = text.bgcol;
523  bool automatte = (0 == tmpbg.a);
524  if (automatte)
525  text.bgcol = GFXColor( 0, 0, 0, base_text_background_alpha );
526  if ( !automatte && text.GetText().empty() ) {
527  float posx, posy, wid, hei;
528  text.GetPos( posy, posx );
529  text.GetSize( wid, hei );
530 
531  GFXColorf( text.bgcol );
532  GFXBegin( GFXQUAD );
533  GFXVertex3f( posx, hei, 0.0f );
534  GFXVertex3f( wid, hei, 0.0f );
535  GFXVertex3f( wid, posy, 0.0f );
536  GFXVertex3f( posx, posy, 0.0f );
537  GFXEnd();
538  } else {
539  text.Draw( text.GetText(), 0, true, false, automatte );
540  }
541  text.bgcol = tmpbg;
542  g_game.x_resolution = tmpx;
543  g_game.y_resolution = tmpy;
544 }
void BaseInterface::Room::BaseText::SetPos ( float  posx,
float  posy 
)
inline

Definition at line 202 of file base.h.

References TextPlane::SetPos(), and text.

203  {
204  text.SetPos( posx, posy );
205  }
void BaseInterface::Room::BaseText::SetSize ( float  wid,
float  hei 
)
inline

Definition at line 206 of file base.h.

References TextPlane::SetSize(), and text.

207  {
208  text.SetSize( wid, hei );
209  }
void BaseInterface::Room::BaseText::SetText ( const std::string &  newtext)
inline

Definition at line 198 of file base.h.

References TextPlane::SetText(), and text.

199  {
200  text.SetText( newtext );
201  }

Member Data Documentation

TextPlane BaseInterface::Room::BaseText::text

Definition at line 172 of file base.h.

Referenced by BaseText(), SetPos(), SetSize(), and SetText().


The documentation for this class was generated from the following files: