From: "Damian Yerrick" 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 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.