Changing the character output.

This is a discussion on Changing the character output. within the C++ Programming forums, part of the General Programming Boards category; Situation : This is for a game I am making. I have a bitmap file with all 26 characters of ...

  1. #1
    Registered User InFeStEd-ArCh0n's Avatar
    Join Date
    Apr 2002
    Posts
    63

    Question Changing the character output.

    Situation:
    This is for a game I am making. I have a bitmap file with all 26 characters of the alphabet. The ASCII codes for each character in windows at least, for uppercase, start at the ASCII value of 65. This does not reflect in any way upon the position they are in the bitmap file. In the bitmap file letter A is 0, B is 1, and C is 2, and so forth. I need to change the ASCII values into my own custom values (the order that they are in the bitmap).

    Question:
    Is there a way to set C++ to compile all strings NOT with the ASCII codes but with my own custom character set. Meaning, is there a way to make C++ take each character in a string and write it in memory with the position they have in the bitmaps? Like "ABCD" would place "0,1,2,3" in memeory. If possible, I'd like this to be done before runtime with preprocessing macros.

  2. #2
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    I can't think of a define substitution that'd help you as I think you might like, convieniently as it seems you'd like. Perhaps you can rewrite your own string class that'd call a constructor to reassign your values [translated] into some constant data. Other than that I can only think to do manual translation of all relevant strings. Aside from that, if you are using your own bitmapped file format, you can alter it as needed up saving and loading. Is this a text-based game, I might presume?

    -hth
    hasafraggin shizigishin oppashigger...

  3. #3
    Registered User Liam Battle's Avatar
    Join Date
    Jan 2002
    Posts
    114
    you can use preprocessor directives and make macro's or you can use enumeration to accomplish this...

    it will work cuz ive done it once before
    LB0: * Life once school is done
    LB1: N <- WakeUp;
    LB2: N <- C++_Code;
    LB3: N >= Tired : N <- Sleep;
    LB4: JMP*-3;

  4. #4
    Registered User InFeStEd-ArCh0n's Avatar
    Join Date
    Apr 2002
    Posts
    63

    But how can I do that?

    But can you teach me how to write it with the preprocesing directives and/or enumeration? Can you show me a sample line? I really do need this, the severity of the situation is terrible. I've been searching for so long.
    Last edited by InFeStEd-ArCh0n; 05-02-2002 at 09:59 PM.

  5. #5
    Registered User InFeStEd-ArCh0n's Avatar
    Join Date
    Apr 2002
    Posts
    63

    Unhappy Please?

    Please?
    -Mike
    {InFeStEd-ArCh0n}

  6. #6
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    Why not just compensate for the offset?
    You know the values for the letters in your bitmap, and you know the character codes... to me, it doesn't seem too hard.

  7. #7
    Registered User InFeStEd-ArCh0n's Avatar
    Join Date
    Apr 2002
    Posts
    63

    Post

    I was never looking for the easiest way out. I just knew there had to be a way to do things the way I described (through preprocessing). It was a simple quest for knowledge, although no one seems to be able to have an answere and my quest about ends here. I could have done it by subtraction a long time ago. But I would rather know what I am asking.
    -Mike
    {InFeStEd-ArCh0n}

  8. #8
    Registered User InFeStEd-ArCh0n's Avatar
    Join Date
    Apr 2002
    Posts
    63

    Unhappy Help...

    If anyone can help me I am basically, only, bit below desperate
    -Mike
    {InFeStEd-ArCh0n}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  2. Changing one character in a char[]
    By codegirl in forum C++ Programming
    Replies: 4
    Last Post: 09-15-2003, 03:40 PM
  3. changing cout output
    By Yohumbus in forum C++ Programming
    Replies: 1
    Last Post: 10-23-2002, 04:09 AM
  4. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM
  5. I can't output this, no matter how hard I try
    By Zewu in forum C++ Programming
    Replies: 10
    Last Post: 01-25-2002, 08:13 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21