2001-11-04 19:34:28 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
File: BitmapText.h
|
|
|
|
|
|
|
|
|
|
Desc: A font class that draws characters from a bitmap.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001 Chris Danford. All rights reserved.
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
2001-11-03 10:52:42 +00:00
|
|
|
|
|
|
|
|
#ifndef _BITMAPTEXT_H_
|
|
|
|
|
#define _BITMAPTEXT_H_
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "Sprite.h"
|
|
|
|
|
#include "BitmapText.h"
|
|
|
|
|
|
2001-11-27 22:47:30 +00:00
|
|
|
|
|
|
|
|
const int NUM_CHARS = 256;
|
2001-11-03 10:52:42 +00:00
|
|
|
|
|
|
|
|
|
2001-11-27 22:47:30 +00:00
|
|
|
class BitmapText : public Sprite
|
2001-11-03 10:52:42 +00:00
|
|
|
{
|
2001-11-27 22:47:30 +00:00
|
|
|
protected:
|
|
|
|
|
|
2001-11-03 10:52:42 +00:00
|
|
|
public:
|
|
|
|
|
BitmapText();
|
|
|
|
|
|
2001-11-25 04:31:44 +00:00
|
|
|
bool LoadFromFontName( CString sFontName );
|
|
|
|
|
void SetText( CString sText ) { m_sText = sText; };
|
2001-11-03 10:52:42 +00:00
|
|
|
CString GetText() { return m_sText; };
|
|
|
|
|
|
2001-11-27 22:47:30 +00:00
|
|
|
bool LoadFontWidths( CString sFilePath );
|
|
|
|
|
//float GetWidthZoomed();
|
2001-11-25 04:31:44 +00:00
|
|
|
|
2001-11-27 22:47:30 +00:00
|
|
|
// void SetTopColor( D3DXCOLOR new_color ) { m_colorTop = new_color; };
|
|
|
|
|
// void SetBottomColor( D3DXCOLOR new_color ) { m_colorBottom = new_color; };
|
|
|
|
|
// void SetColor( D3DXCOLOR new_color ) { SetTopColor(new_color); SetBottomColor(new_color); };
|
|
|
|
|
|
|
|
|
|
void Draw();
|
2001-11-03 10:52:42 +00:00
|
|
|
|
2001-12-19 01:50:57 +00:00
|
|
|
float GetWidthInSourcePixels(); // in logical, pre-scaled units
|
|
|
|
|
|
2001-11-03 10:52:42 +00:00
|
|
|
protected:
|
2001-11-27 22:47:30 +00:00
|
|
|
bool LoadCharWidths( CString sWidthFilePath );
|
|
|
|
|
|
2001-11-25 04:31:44 +00:00
|
|
|
CString m_sFontName;
|
2001-11-27 22:47:30 +00:00
|
|
|
float m_fCharWidthsInSourcePixels[NUM_CHARS]; // in soure coordinate space
|
|
|
|
|
|
2001-11-03 10:52:42 +00:00
|
|
|
CString m_sText; // the string that the font is displaying
|
2001-11-27 22:47:30 +00:00
|
|
|
// D3DXCOLOR m_colorTop;
|
|
|
|
|
// D3DXCOLOR m_colorBottom;
|
2001-12-19 01:50:57 +00:00
|
|
|
// bool m_bHasShadow;
|
2001-11-03 10:52:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|