Thread: What are some ways to translate an image made up of text characters in a function?

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    4

    What are some ways to translate an image made up of text characters in a function?

    Meaning when asked the user could input x number of character spaces to move the image up, and then x number of character spaces to move to the right. So you're basically manipulating the rows and columns.

    But another problem that I think would come up would be when the text is transferred past the end of the page, how would i bring that 'fallen off' text back to the other side. ie: if the text were transferred to the right, once the text goes off the page to the right it would end up on the leftmost side of the image.

    thanks for any help or suggestions.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    If you set your text up as an array of strings, these are just simple array manipulations...

    For example to move the text down one line...
    Code:
    for (x = last line; x > 0; x--)
      for (y = 0; y < length; y++)
         array[x][y] = array[x-1][y];
    
    for (y = 0; y< length; y++)
      array[0][y] = ' ';
    Just make sure your arrays are bigger than your text... if you have 30 lines at 60 characters wide... and want to adjust by +-5 your arrays need to be 40 x 71.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Any other ways to perform this function?
    By TRiley in forum C++ Programming
    Replies: 1
    Last Post: 12-09-2009, 07:19 AM
  2. a translate function
    By AngKar in forum C Programming
    Replies: 2
    Last Post: 04-27-2006, 11:32 PM
  3. Can Someone Translate this text
    By lanh215 in forum C++ Programming
    Replies: 24
    Last Post: 01-17-2006, 10:02 AM
  4. can anyone translate this all to aschii characters?
    By tetra in forum C++ Programming
    Replies: 9
    Last Post: 04-14-2003, 09:18 PM
  5. Worked, then made it a function: Console
    By RoD in forum C++ Programming
    Replies: 3
    Last Post: 01-04-2003, 03:46 PM