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; }
|
2000-09-12 01:41:29 +02:00
|
|
|
virtual void print( int _x, int _y, char *_text );
|
2000-08-29 21:54:22 +02:00
|
|
|
void print( int _x, int _y, s32 _textId );
|
|
|
|
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 );
|
|
|
|
|
2000-09-12 01:41:29 +02:00
|
|
|
int getCharWidth( char _char );
|
2000-08-29 21:54:22 +02:00
|
|
|
int getCharHeight();
|
|
|
|
int getStringWidth( char * text );
|
2000-09-12 01:41:29 +02:00
|
|
|
int getStringHeight( char *_text );
|
2000-08-29 21:54:22 +02:00
|
|
|
|
2000-09-12 01:41:29 +02:00
|
|
|
int getStrWrapLen( 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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#endif /* __GFX_FONT_H__ */
|
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|