home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
177.lha
/
FasText_v3.0
/
Ftest.c
< prev
next >
Wrap
C/C++ Source or Header
|
1988-04-28
|
3KB
|
133 lines
/*
* FastText() text demo by Darren M. Greenwald
* Copyright 1987 - FastText() REV 3.0
*
* "C" example of use.
*
* You MUST assemble, and link in the FastText file in order for this to
* work!!!
*
* Note that all work was done using Manx 3.6
* I leave it up to you to make adjustments as needed to work with your
* compiler/assembler.
*
* TURN OFF any text speed up programs if you really want to test this
* program right. Programs such BLITZFONTS, and MicroSmith's FastFonts
* only speed up 8 bit wide fonts. These routines allow you to gain
* a significant speed up for all size fonts, and the most speed up for
* 8 bit wide fonts. Font widths other then 8 bits wide will vary in
* speed. Thinner fonts will be drawn more quickly then wider fonts, but
* you can rest assured that the FastText() routines draw text faster then
* Text() - generally MUCH faster.
*
* If the font cannot be drawn faster (e.g., too wide, too thin, PROP
* font), then Text() is automatically called.
*
*/
#include <exec/types.h>
#include <intuition/intuition.h>
#include <exec/memory.h>
#define REV 0L
#define SIZE 640L
struct IntuitionBase *IntuitionBase = NULL;
struct GfxBase *GfxBase = NULL;
struct Window *Window = NULL;
struct RastPort *rp;
struct Window *OpenWindow();
void *OpenLibrary();
struct NewWindow NewWindow =
{ 0,0,640,200,0,1,
CLOSEWINDOW,ACTIVATE|BORDERLESS|WINDOWDEPTH|WINDOWCLOSE|SMART_REFRESH,
NULL,NULL,
(UBYTE *)"FastText Demo Rev 3.0 - Close me!",
NULL,NULL,0,0,0,0,WBENCHSCREEN
};
void Cleanup();
void main()
{
ULONG MaxRows,fonthght,pixrow,i,j;
IntuitionBase = (struct IntuitionBase *)
OpenLibrary("intuition.library",REV);
if(IntuitionBase == NULL) Cleanup();
GfxBase = (struct GfxBase *)
OpenLibrary("graphics.library",REV);
if(GfxBase == NULL) Cleanup();
Window = (struct Window *)
OpenWindow(&NewWindow);
if(Window == NULL) Cleanup();
rp = Window->RPort;
/*
* Wait till the close us down cause we are to lazy to mess with gadgets,
* or menus!
*/
Wait(1L<<Window->UserPort->mp_SigBit);
SetAPen(rp,1L);
SetBPen(rp,0L);
InitFastText(rp->Font); /* You could check for a TRUE/FALSE return */
pixrow=32L;
fonthght=(ULONG)rp->Font->tf_YSize;
MaxRows=(Window->Height-pixrow)/fonthght;
SetWindowTitles(Window,"Drawing via Text()",NULL);
for(i=1;i<MaxRows;i++) /* do maximum # of times possible */
{
for(j=1;j<200;j++) /* redraw line 300 times per row */
{
Move(rp,j+4L,pixrow);
Text(rp," This is 36 characters of SLOW text!",36L);
}
pixrow+=fonthght;
}
dox: pixrow=32L;
SetWindowTitles(Window,"Drawing via FastText()",NULL);
for(i=1;i<MaxRows;i++) /* do maximum # of times possible */
{
for(j=1;j<200;j++) /* redraw line 300 times per row */
{
Move(rp,j+4L,pixrow);
FastText(rp," This is 36 characters of FAST text!",36L);
}
pixrow+=fonthght;
}
Cleanup();
}
void Cleanup()
{
FreeFastText();
if(Window) CloseWindow(Window);
if(GfxBase) CloseLibrary(GfxBase);
if(IntuitionBase) CloseLibrary(IntuitionBase);
exit(0L);
}