2002-11-16 08:07:38 +00:00
|
|
|
#ifndef BITMAPTEXT_H
|
|
|
|
|
#define BITMAPTEXT_H
|
2001-11-04 19:34:28 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2002-03-30 20:00:13 +00:00
|
|
|
File: BitmapText
|
2001-11-04 19:34:28 +00:00
|
|
|
|
2002-03-30 20:00:13 +00:00
|
|
|
Desc: An actor that holds a Font and draws text to the screen.
|
2001-11-04 19:34:28 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-03-30 20:00:13 +00:00
|
|
|
Chris Danford
|
2001-11-04 19:34:28 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
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
|
|
|
|
2002-03-30 20:00:13 +00:00
|
|
|
class BitmapText : public Actor
|
2001-11-03 10:52:42 +00:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
BitmapText();
|
2002-08-23 08:30:10 +00:00
|
|
|
virtual ~BitmapText();
|
2001-11-03 10:52:42 +00:00
|
|
|
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-08-13 23:26:46 +00:00
|
|
|
bool LoadFromFont( CString sFontName );
|
2002-09-22 18:18:50 +00:00
|
|
|
bool LoadFromNumbers( CString sTexturePath ) { return LoadFromTextureAndChars(sTexturePath,"0123456789%. :x"); };
|
2002-08-13 23:26:46 +00:00
|
|
|
bool LoadFromTextureAndChars( CString sTexturePath, CString sChars );
|
2003-11-06 06:20:35 +00:00
|
|
|
void SetText( CString sText, CString sAlternateText = "", int iWrapWidthPixels = -1 );
|
2003-12-17 09:47:03 +00:00
|
|
|
void SetMaxWidth( float MaxWidth );
|
2003-11-06 07:23:22 +00:00
|
|
|
void SetWrapWidthPixels( int iWrapWidthPixels );
|
2001-11-03 10:52:42 +00:00
|
|
|
|
2002-08-22 09:31:32 +00:00
|
|
|
void CropToWidth( int iWidthInSourcePixels );
|
2001-11-25 04:31:44 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
virtual void DrawPrimitives();
|
2001-12-19 01:50:57 +00:00
|
|
|
|
2002-04-16 17:31:00 +00:00
|
|
|
void TurnRainbowOn() { m_bRainbow = true; };
|
|
|
|
|
void TurnRainbowOff() { m_bRainbow = false; };
|
2001-11-27 22:47:30 +00:00
|
|
|
|
2003-01-04 07:55:42 +00:00
|
|
|
void SetHorizAlign( HorizAlign ha );
|
|
|
|
|
void SetVertAlign( VertAlign va );
|
|
|
|
|
|
2003-11-06 07:23:22 +00:00
|
|
|
CString GetText() const { return m_sText; }
|
2003-02-12 20:19:20 +00:00
|
|
|
/* Return true if the string 's' will use an alternate string, if available. */
|
|
|
|
|
bool StringWillUseAlternate(CString sText, CString sAlternateText) const;
|
2003-02-12 19:34:53 +00:00
|
|
|
|
2004-01-10 20:34:18 +00:00
|
|
|
virtual void HandleCommand( const ParsedCommand &command );
|
2003-11-06 07:23:22 +00:00
|
|
|
|
2002-09-29 05:06:18 +00:00
|
|
|
public:
|
2002-03-30 20:00:13 +00:00
|
|
|
Font* m_pFont;
|
2002-09-29 05:06:18 +00:00
|
|
|
|
|
|
|
|
protected:
|
2002-02-02 05:11:12 +00:00
|
|
|
|
2002-03-30 20:00:13 +00:00
|
|
|
// recalculate the items below on SetText()
|
2003-11-06 07:23:22 +00:00
|
|
|
CString m_sText;
|
|
|
|
|
vector<wstring> m_wTextLines;
|
2002-12-29 22:55:26 +00:00
|
|
|
vector<int> m_iLineWidths; // in source pixels
|
2003-11-06 07:23:22 +00:00
|
|
|
int m_iWrapWidthPixels; // -1 = no wrap
|
2003-12-17 09:47:03 +00:00
|
|
|
float m_fMaxWidth;
|
2003-01-10 02:54:07 +00:00
|
|
|
|
2002-04-16 17:31:00 +00:00
|
|
|
bool m_bRainbow;
|
2003-01-04 07:55:42 +00:00
|
|
|
|
2003-07-07 01:29:18 +00:00
|
|
|
vector<RageSpriteVertex> verts;
|
2003-01-04 07:55:42 +00:00
|
|
|
vector<RageTexture *> tex;
|
|
|
|
|
|
|
|
|
|
void BuildChars();
|
|
|
|
|
void DrawChars();
|
2003-12-17 09:47:03 +00:00
|
|
|
void UpdateBaseZoom();
|
2001-11-03 10:52:42 +00:00
|
|
|
};
|
|
|
|
|
|
2002-11-16 08:07:38 +00:00
|
|
|
|
|
|
|
|
#endif
|