home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_C
/
TGE131.ZIP
/
INCLUDE
/
FIXFONT.H
next >
Wrap
C/C++ Source or Header
|
1994-03-05
|
3KB
|
100 lines
/*****************************************************************************
* The Graphics Engine version 1.31 *
* *
* The Graphics Engine code and documentation are *
* Copyright (c) 1993-1994 by Matthew Hildebrand; all rights reserved. *
* *
* Unauthorised usage or modification of any or all of The Graphics *
* Engine is strictly prohibited. *
*****************************************************************************/
#if !defined(FONTdotH)
#define FONTdotH
//*****
//***** Bitmapped font services class
//*****
class FixedFont
{
unsigned charWide, charDeep; // character cell dimensions
unsigned realCharWide; // real character width (before adjustment)
unsigned char fgColour, bgColour; // font colours (0=invisible)
void far *rawData; // raw character data here
void far *image; // buffer for putImageInv()
unsigned charSize; // character image size in bytes
public:
FixedFont(char *filename, unsigned char fg=1, unsigned char bg=0);
~FixedFont();
inline int status(void); // return status code (0=ERROR)
unsigned width(char *str); // string width in pixels
inline unsigned width(char ch); // character width in pixels
inline unsigned maxWidth(void); // max character width in pixels
inline unsigned height(char *str); // string depth in pixels
inline unsigned height(char ch); // character depth in pixels
inline unsigned maxHeight(void); // max character height in pixels
void put(int x, int y, char *str); // write a string
void put(int x, int y, char ch); // write a single character
inline void foreground(unsigned c); // set foreground colour
inline void background(unsigned c); // set background colour
inline unsigned foreground(void); // get foreground colour
inline unsigned background(void); // get background colour
};
inline int FixedFont::status(void)
{
return (rawData==NULL ? 0 : 1);
}
inline unsigned FixedFont::width(char)
{
return (realCharWide);
}
inline unsigned FixedFont::maxWidth(void)
{
return (realCharWide);
}
inline unsigned FixedFont::height(char *)
{
return (charDeep);
}
inline unsigned FixedFont::height(char)
{
return (charDeep);
}
inline unsigned FixedFont::maxHeight(void)
{
return (charDeep);
}
inline void FixedFont::foreground(unsigned colour)
{
fgColour = colour;
}
inline void FixedFont::background(unsigned colour)
{
bgColour = colour;
}
inline unsigned FixedFont::foreground(void)
{
return (fgColour);
}
inline unsigned FixedFont::background(void)
{
return (bgColour);
}
#endif