delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/29/09:11:12

Message-Id: <199710290727.UAA17119@fep1-orange.clear.net.nz>
From: "Jamie Love" <jamie DOT love AT clear DOT net DOT nz>
To: <djgpp AT delorie DOT com>
Subject: Re: Newbie allegro graphics question
Date: Wed, 29 Oct 1997 08:57:13 +1300
MIME-Version: 1.0

----------
> From: Mark Phillips <bigphil AT solutions DOT mb DOT ca>
> To: djgpp AT delorie DOT com
> Subject: Newbie allegro graphics question
> Date: Tuesday, October 28, 1997 11:47
> 
> 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
> 

To do this you must convert the integer to a string first like so:
#include <stdlib..h>  (at the start of your file)

and use the itoa (ie, integer to to ascii) function like so:

itoa( my_int, dummy_string, base_conversion);

where my_int is the int you want change, dummy_string is a character buffer
long enought to hold the converted integer and base_conversion is the base
number you want the integer to convert by (ie, base ten, base 2 etc, use
base ten for normal numbers).

then call the textout function with the dummy_string.

textout(screen, font, dummy_string, x, y, colour);


J Love

- Raw text -


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