delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/12/21:26:52

From: "Damian Yerrick" <Damian DOT E DOT Yerrick AT rose-hulman DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: allegro textout
Date: Thu, 12 Aug 1999 23:49:01 -0500
Organization: Rose-Hulman Institute of Technology
Lines: 43
Message-ID: <7ouu04$ca4$1@solomon.cs.rose-hulman.edu>
References: <7op7if$src$1 AT garnet DOT nbnet DOT nb DOT ca> <37B14F14 DOT 4EEBF047 AT pmail DOT net>
NNTP-Posting-Host: 137.112.109.21
X-Trace: solomon.cs.rose-hulman.edu 934476612 12612 137.112.109.21 (12 Aug 1999 16:50:12 GMT)
X-Complaints-To: news AT cs DOT rose-hulman DOT edu
NNTP-Posting-Date: 12 Aug 1999 16:50:12 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> guthrie wrote:
>
> > how can I , if even possible , print a string or char array out to the
> > screen using the textout  or textout_centre allegro functions?
> >

Fred Backman <fredrick DOT backman AT pmail DOT net> wrote in message
news:37B14F14 DOT 4EEBF047 AT pmail DOT net...
> As always, there's many ways to do it, but try something like the
following:
>
> char foo[32];   // Max. 32 characters
>
> sprintf(foo, "Parrot ate a cracker!");
> textout(screen, font, foo, 300, 125, color1);
>
> Then it's up to you to put anything into foo, as long as length < 32.
Another
> sample:
>
> sprintf(foo, "Parrot ate %d crackers!", ncrackers);
> textout(screen, font, foo, 300, 125, color1);
>
>
> Fred Backman,
> Lead Wizard
> Binary Spells
> www.binaryspells.com

Allegro has something even simpler: textprintf().
void textprintf(BITMAP *bmp, FONT *theFont, int x, int y, int color, char
*format, ...);
Structure the format string as you would for printf(). Common call:
textprintf(screen, font, 0, 192, 15, "Score: %6d", score);

If you want to see more examples of textprintf(), download DOSArena(TM) from
my home page:

http://www.rose-hulman.edu/~yerricde

DOSArena is a trademark of Damian Yerrick.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019