delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/30/02:01:36

From: Barry Rodewald <bsr AT hn DOT pl DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Newbie allegro graphics question
Date: Tue, 28 Oct 1997 13:51:12 +1300
Lines: 22
Message-ID: <345536FF.1A58@hn.pl.net>
References: <6335en$1ed$1 AT postern DOT mbnet DOT mb DOT ca>
NNTP-Posting-Host: bsr.hn.planet.gen.nz
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Mark Phillips wrote:
> 
> If I am in graphics mode (any one) and I want to write an integer to
> the screen, how do I do it? thanks in advance,
> 
> mark phillips

First, try to create a string containing the integer.  You can use
sprintf.  eg: sprintf(string,"%i",integer);

Next, use Allegro's textout function to write the string to a bitmap.
eg: textout(screen, font, string, x, y, colour);
Note that there is a variable called screen and one called font.  screen
refers to the actual screen, and font refers to the default font.  You
can replace screen with any bitmap in case you are using a double
buffering technique for graphics, that is write all the graphics for one
frame onto a memory bitmap then blit (copy) it in one go to the screen.

x and y are the location of the bitmap/screen to write to.

Hope that this clears it up,
Barry Rodewald.

- Raw text -


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