Files
itgmania212121/stepmania/src/BitmapText.h
T

57 lines
1.2 KiB
C++
Raw Normal View History

/*
-----------------------------------------------------------------------------
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"
const int NUM_CHARS = 256;
2001-11-03 10:52:42 +00:00
class BitmapText : public Sprite
2001-11-03 10:52:42 +00:00
{
protected:
2001-11-03 10:52:42 +00:00
public:
BitmapText();
2002-01-16 10:01:32 +00:00
virtual void RenderPrimitives();
bool Load( CString sFontName );
2001-12-28 10:15:59 +00:00
void SetText( CString sText );
CString GetText();
2001-11-03 10:52:42 +00:00
bool LoadFontWidths( CString sFilePath );
2001-12-28 10:15:59 +00:00
float GetWidestLineWidthInSourcePixels(); // in logical, pre-zoomed units
float GetLineWidthInSourcePixels( int iLineNo );
2001-12-19 01:50:57 +00:00
2001-11-03 10:52:42 +00:00
protected:
bool LoadCharWidths( CString sWidthFilePath );
2002-02-02 05:11:12 +00:00
// a vertex buffer for all to share
2002-01-16 10:01:32 +00:00
CString m_sFontFilePath;
int m_iCharToFrameNo[NUM_CHARS];
float m_fFrameNoToWidth[NUM_CHARS]; // in soure coordinate space
2001-12-28 10:15:59 +00:00
2002-02-02 05:11:12 +00:00
LPDIRECT3DVERTEXBUFFER8 m_pVB; // our vertex buffer only needs to be rebuilt when the text changes
int m_iNumVerticies;
RebuildVertexBuffer(); // this should be called when the
2001-12-28 10:15:59 +00:00
CStringArray m_sTextLines;
2001-11-03 10:52:42 +00:00
};
#endif