Thread: allegro output

  1. #1

    allegro output

    How can i output an integer variable to the screen, textout only allows strings.


  2. #2
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    I'm not sure if there are any functions in allegro to output integers and whatnot, but the most logical thing to do at this step would be convert the integers to a string and print them out...

    char pszFinalString[30];
    char pcszText[] = "A number: ";
    int iNumber = 10;

    sprintf(pszFinalString, "%s%d", pcszText, iNumber);
    printf("%s\n", pszFinalString);

  3. #3
    I think they should've documented this in the manual

    textprintf() will do it.

    replace the ? with

    i - integer
    g - integer
    f- float
    c - char
    s - string

    and all the other ones printf uses.

  4. #4
    Rambling Man
    Join Date
    Jan 2002

    char prinstr[50];
    sprintf(printstr, variable);
    textout(buffer, font, printstr, 550, 340, makecol(100, 100, 100)); 
    //notice i drew the text to a buffer and not the screen!
    //the color of 100,100,100 is a goes R(red)G(green)B(blue)...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. code output...
    By roaan in forum C Programming
    Replies: 6
    Last Post: 07-03-2009, 02:22 AM
  2. Help for my output array
    By qwertysingh in forum C Programming
    Replies: 1
    Last Post: 02-17-2009, 03:08 PM
  3. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 03:29 PM
  4. Trying to store system(command) Output
    By punxworm in forum C++ Programming
    Replies: 5
    Last Post: 04-20-2005, 06:46 PM
  5. double buffering for allegro
    By Leeman_s in forum C++ Programming
    Replies: 6
    Last Post: 09-12-2002, 02:45 PM