Files
itgmania212121/stepmania/src/BitmapText.h
T

66 lines
1.5 KiB
C++
Raw Normal View History

#ifndef BITMAPTEXT_H
#define BITMAPTEXT_H
/*
-----------------------------------------------------------------------------
File: BitmapText
Desc: An actor that holds a Font and draws text to the screen.
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
2001-11-03 10:52:42 +00:00
#include "Sprite.h"
2002-12-29 22:55:26 +00:00
class Font;
2001-11-03 10:52:42 +00:00
class BitmapText : public Actor
2001-11-03 10:52:42 +00:00
{
public:
BitmapText();
virtual ~BitmapText();
2001-11-03 10:52:42 +00:00
bool LoadFromFont( CString sFontName );
bool LoadFromNumbers( CString sTexturePath ) { return LoadFromTextureAndChars(sTexturePath,"0123456789%. :x"); };
bool LoadFromTextureAndChars( CString sTexturePath, CString sChars );
2002-03-31 07:55:25 +00:00
void SetText( CString sText );
int GetWidestLineWidthInSourcePixels() { return m_iWidestLineWidth; };
2002-08-22 09:31:32 +00:00
void CropToWidth( int iWidthInSourcePixels );
2002-05-19 01:59:48 +00:00
virtual void DrawPrimitives();
2002-01-16 10:01:32 +00:00
2002-04-16 17:31:00 +00:00
void TurnRainbowOn() { m_bRainbow = true; };
void TurnRainbowOff() { m_bRainbow = false; };
2001-12-19 01:50:57 +00:00
2003-01-04 07:55:42 +00:00
void SetHorizAlign( HorizAlign ha );
void SetVertAlign( VertAlign va );
2002-09-29 05:06:18 +00:00
public:
2002-01-16 10:01:32 +00:00
CString m_sFontFilePath;
Font* m_pFont;
2002-09-29 05:06:18 +00:00
protected:
2001-12-28 10:15:59 +00:00
// recalculate the items below on SetText()
2002-12-29 22:55:26 +00:00
CString m_szText;
vector<CString> m_szTextLines;
vector<int> m_iLineWidths; // in source pixels
2003-01-04 01:47:01 +00:00
vector<int> m_iLineHeights; // in source pixels
2002-12-29 22:55:26 +00:00
int m_iWidestLineWidth; // in source pixels
2002-02-02 05:11:12 +00:00
2002-04-16 17:31:00 +00:00
bool m_bRainbow;
2003-01-04 07:55:42 +00:00
vector<RageVertex> verts;
vector<RageTexture *> tex;
void BuildChars();
void DrawChars();
2001-11-03 10:52:42 +00:00
};
#endif