// One time call to create inverse font
static void InitializeFonts(
void );
// Parents Setup() must set xRes and yRes before
call this...
virtual void Setup( void );
virtual void Cleanup( void
);
BOOL IsReady( void )
{ return ready; };
virtual void StartFrame( void
) = 0;
virtual void ClearFrame( void
) = 0;
virtual void FinishFrame(
void ) = 0;
virtual void Point( float x1,
float y1 );
virtual void Line( float x1,
float y1, float x2, float y2 );
virtual void Tri( float x1,
float y1, float x2, float y2, float x3, float y3 );
virtual void Oval (float x, float y, float
xRadius, float yRadius);
virtual void OvalArc (float x, float y,
float xRadius, float yRadius, float start, float stop);
virtual void Circle ( float x, float y,
float xRadius )
{ Oval(x, y, xRadius, xRadius*scaleX/scaleY);
};
virtual void Arc ( float x, float y, float
xRadius, float start, float stop )
{ OvalArc(x, y, xRadius, xRadius*scaleX/scaleY,
start, stop); };
virtual void TextLeft( float x1, float y1,
char *string, int boxed = 0 );
virtual void TextRight( float x1, float
y1, char *string, int boxed = 0 );
virtual void TextLeftVertical( float x1,
float y1, char *string, int boxed = 0 );
virtual void TextRightVertical( float x1,
float y1, char *string, int boxed = 0 );
virtual void TextCenter( float x1, float
y1, char *string, int boxed = 0 );
virtual void TextCenterVertical( float
x1, float y1, char *string, int boxed = 0 );
virtual int TextWrap( float h, float
v, char *string, float spacing, float width );
// NOTE: These might need to be virtualized and overloaded
by canvas3d (maybe???)
virtual float TextWidth(char *string) {
return ScreenTextWidth(string)/scaleX; }; // normalized screen space
virtual float TextHeight(void)
{ return ScreenTextHeight()/scaleY; }; // normalized screen space
// Screen space text printing (based on
upper left starting pixel)
virtual void ScreenText( float x, float
y, char *string, int boxed = 0 );
virtual void ScreenChar( float x, float
y, char *string, int boxed = 0 );
static int ScreenTextWidth(
char *string ); // Returns in units of pixels
staticint ScreenTextHeight(
void ); // Returns in units of pixels
static int CurFont(void)
{return FontNum;};
static
void SetFont (int newFont) {FontNum = newFont;};
virtual void SetLineStyle (int) {};
virtual DWORD Color( void ) {return 0x0;
};
virtual void SetColor( DWORD ) {};
// Override for color displays
virtual void SetBackground( DWORD ) {};
// Override for color displays
virtual void SetViewport( float
leftSide, float topSide, float rightSide, float bottomSide );
virtual void SetViewportRelative(
float leftSide, float topSide, float rightSide, float bottomSide );
void AdjustOriginInViewport(
float horizontal, float vertical );
void AdjustRotationAboutOrigin( float angle );
void CenterOriginInViewport( void )
{ translationX = 0.0f; translationY = 0.0f; };
void ZeroRotationAboutOrigin(
void ) { rotation01 = rotation10 = 0.0f, rotation00 = rotation11 = 1.0f;
};
int GetXRes(void) { return
xRes; };
int GetYRes(void) { return
yRes; };
void GetViewport( float *leftSide, float *topSide, float *rightSide, float *bottomSide );
float GetTopPixel( void ) { return
topPixel; };
float GetBottomPixel( void ) { return bottomPixel;
};
float GetLeftPixel( void ) { return
leftPixel; };
float GetRightPixel( void ) { return
rightPixel; };
float GetXOffset(void) { return shiftX;
};
float GetYOffset(void) { return shiftY;
};
enum {
DISPLAY_GENERAL = 0,
DISPLAY_CANVAS
} type;
// Functions to convert from normalized coordinates
to pixel coordinates
// (assumes at this point that x is right and y is down)
float viewportXtoPixel( float
x ) { return (x * scaleX) + shiftX; };
float viewportYtoPixel( float
y ) { return (y * scaleY) + shiftY; };
protected:
// Functions which must be provided by all derived
classes
virtual void Render2DPoint(
float x1, float y1 ) = 0;
virtual void Render2DLine(
float x1, float y1, float x2, float y2 ) = 0;
// Functions which should
be provided by all derived classes
virtual void Render2DTri(
float x1, float y1, float x2, float y2, float x3, float y3 );
protected:
// Store the currently selected resolution
int xRes;
int yRes;
// The viewport properties
in normalized screen space (-1 to 1)
float left, right;
float top, bottom;
// The parameters required
to get from normalized screen space to pixel space
// TEMPORARILY PUBLIC TO GET THINGS GOING...
public:
float scaleX;
float scaleY;
float shiftX;
float shiftY;
protected:
// Store the pixel space boundries of the
current viewport
// (top/right inclusive, bottom/left exclusive)
float topPixel;
float bottomPixel;
float leftPixel;
float rightPixel;
// The 2D rotation/translation
settings
float translationX, translationY;
float rotation00, rotation01;
float rotation10, rotation11;
// The font information for
drawing text
static const unsigned char FontLUT[256];
static const unsigned char
*Font[];
static const unsigned int FontLength;
static unsigned char
InvFont[][8];
BOOL ready;