SBSPSS/source/gfx/font.h

137 lines
2.9 KiB
C
Raw Normal View History

2000-08-29 21:54:22 +02:00
/*=========================================================================
font.h
Author: PKG
Created:
Project:
Purpose:
Copyright (c) 2000
===========================================================================*/
#ifndef __GFX_FONT_H__
#define __GFX_FONT_H__
/*----------------------------------------------------------------------
Includes
-------- */
#ifndef __GFX_FDATA_H__
#include "gfx\fdata.h"
#endif
#ifndef __GFX_SPRBANK_H__
#include "gfx\sprbank.h"
#endif
/*----------------------------------------------------------------------
Tyepdefs && Defines
------------------- */
/*----------------------------------------------------------------------
Structure defintions
-------------------- */
class FontBank
{
public:
enum Justification
{
JUST_LEFT,
JUST_RIGHT,
JUST_CENTRE
};
FontBank() { m_initialised=false; };
virtual ~FontBank() { ASSERT( !m_initialised ); }
virtual void initialise( FontData *_fontData );
void dump();
int isInitialised() { return m_initialised; }
void print( int _x, int _y, s32 _textId );
2001-07-01 20:40:03 +02:00
virtual void print( int _x, int _y, const char *_text );
int printTillEndOfLine( int _x, int _y, const char *_text );
2000-08-29 21:54:22 +02:00
void setColour( u8 _r, u8 _g, u8 _b );
void setJustification( Justification _justification );
void setOt( u16 _ot );
void setPrintArea( int _x, int _y, int _w, int _h );
void setTrans( int _trans );
void setSMode( int _sMode );
2001-05-31 18:27:21 +02:00
virtual int getCharWidth( char _char );
virtual int getCharHeight();
int getStringWidth( const char * text );
int getStringWidth( s32 _textId );
int getStringHeight( const char *_text );
int getStringHeight( s32 _textId );
2000-08-29 21:54:22 +02:00
2001-05-31 18:27:21 +02:00
virtual int getCharGapX();
virtual int getCharGapY();
int getStrWrapLen( const char *_text,int _maxWidth );
2000-08-29 21:54:22 +02:00
2000-11-09 17:58:22 +01:00
void setWobble(int _wobble) {m_wobble=_wobble;}
2000-08-29 21:54:22 +02:00
private:
2000-09-12 01:41:29 +02:00
virtual int printChar( char _char,int _x,int _y );
2000-08-29 21:54:22 +02:00
enum {
DEFAULT_R=128,
DEFAULT_G=128,
DEFAULT_B=128,
DEFAULT_JUSTIFICATION=JUST_LEFT,
2000-11-15 16:37:12 +01:00
DEFAULT_OT=10,
2000-08-29 21:54:22 +02:00
};
2000-11-09 17:58:22 +01:00
static void think(int _frames); // Needed for the wobble only.. call once from main loop or summink..
friend void MainLoop();
2000-08-29 21:54:22 +02:00
protected:
FontData *m_fontData;
u8 m_r, m_g, m_b; // Font colour
Justification m_justification;
u16 m_ot; // Depth
RECT m_printArea;
SpriteBank m_spriteBank;
int m_initialised;
int m_trans, m_sMode;
2000-11-09 17:58:22 +01:00
int m_wobble;
static int s_wobbleValue;
2000-08-29 21:54:22 +02:00
};
2001-05-31 18:27:21 +02:00
class ScalableFontBank : public FontBank
{
public:
virtual void initialise( FontData *_fontData );
void setScale(int _newScale) {m_fontScale=_newScale;}
virtual int getCharWidth( char _char );
virtual int getCharHeight();
virtual int getCharGapX();
virtual int getCharGapY();
private:
virtual int printChar( char _char,int _x,int _y );
int m_fontScale;
};
2000-08-29 21:54:22 +02:00
/*---------------------------------------------------------------------- */
#endif /* __GFX_FONT_H__ */
/*===========================================================================
end */