Thread: Help with Allegro....

  1. #1
    SublicK
    Guest

    Help with Allegro....

    Hey....

    I am trying to use the textout function to print a string and an int var....but it doesn't work.

    eg.

    string VarName = "Test Text"
    int VarNum = 100;
    textout(screen,font,VarName,X,Y,C);
    textout(screen,font,VarNum,X1,Y1,C);

    How do you print vars???

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    You have to format a string yourself
    char buff[100];
    sprintf( buff, "Test text %d %d", X, Y );
    textout(screen,font,buff,X,Y);
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    textout probably suspects a c style string. So use

    VarName.c_str();
    as long as it's parameter is const char*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Allegro in C for a newb
    By Ideius in forum C Programming
    Replies: 5
    Last Post: 12-29-2005, 04:36 PM
  2. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 02:00 AM
  3. double buffering for allegro
    By Leeman_s in forum C++ Programming
    Replies: 6
    Last Post: 09-12-2002, 02:45 PM
  4. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-20-2002, 11:35 PM
  5. Allegro programming in a window
    By Person Man in forum Windows Programming
    Replies: 0
    Last Post: 11-16-2001, 03:23 PM