Screen Flipping

This is a discussion on Screen Flipping within the C++ Programming forums, part of the General Programming Boards category; Hello Everybody , i'm new in c++ and i just want to know the function that flips the screen from ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    10

    Screen Flipping

    Hello Everybody , i'm new in c++ and i just want to know the function that flips the screen from the right to the left (like The Mirror), please try to reply as fast as you can

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    As far as I know, there is not such a function. Is it a DOS console? You could read in all characters on the screen in an array and print them out in reverse order...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    10
    and how can i do it in an array ?
    i think it's possible with far pointers

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    2

    hmm

    couldn't find any single function that would do this.
    sorry i could not be of any help.maybe i need better books

  5. #5
    Registered User
    Join Date
    Mar 2002
    Posts
    10
    magos, sungod , thnx for interesting really appreciate it , but i really need something that does that screen flipping

  6. #6
    Registered User
    Join Date
    Mar 2002
    Posts
    10
    Anyone Knows ?

  7. #7
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    I've got little experience in PC graphics and only DOS. As far as I know there the pixels of the screen are stored in the video memory. You can access the video memory and if you know the height and width, you can flip the screen by exchanging pixels on the lines.

    (x[0],y[n]) -> (x[i],y[n])

    Here x[0] is the most left pixel and x[i] the most right pixel. Exchanging the pixels in this case means that the most left pixel is exchanged by the most right pixel. Then you have to do the next pixel

    (x[1],y[n]) -> (x[i-1],y[n])

    And so on and for each line. Hope it's a little bit clear. But first you have to know how to reach the video memory, if required ofcourse. I know that many graphics chips store more than one page in memory. You could read such a page, flip it and then put it on the screen.

  8. #8
    Registered User
    Join Date
    Apr 2002
    Posts
    10

    hi bemoi

    how are u today?
    i think that what u want is too easy that u can put ur words in array of char then make 2 pointers one points to the first element array[0] , and another points to the last element in the array ,array[n-1] ,
    and then swap between the first and the last pointers and so on......................
    dr_mysterious

  9. #9
    Registered User
    Join Date
    Mar 2002
    Posts
    23
    are you trying to flip the console? Basically IF you had everything stored in a 2D array you just do what everyone said. Just think of your screen as a 10x10 matrix (or whatever size you want) and then think of the algorithm for flipping each part of that matrix. You can store the new parts into a new 10x10 matrix or whatever.

    Basically that is the idea that everyone is trying to explain to you. If you wanted to reverse more than just text then maybe the suggestion by shiro would be more towards what you want. However again it is the same idea.

  10. #10
    MathFan
    Guest
    If u r a beginner in c++, the easiest way to do it is just to store all data on the screen in an array and put it on the screen again backwards. Easy... But I can't think of a standard single function that can do anything like that

  11. #11
    Registered User
    Join Date
    Mar 2002
    Posts
    10

    Demonstration

    Ok , There You A Demonstartion For What i Need , Please i need some help
    Attached Images Attached Images  

  12. #12
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    This is a little program that mirrors the text on screen. I don't know if these are standard functions or not.
    Code:
    #include <conio.h>
    #include <iostream.h>
    
    int main()
    {
       char buffer[4096];
    
       //*** Input whatever text you want here ***
    
       getch();
       gettext(1, 1, 80, 25, buffer);
       clrscr();
       for(int y=0; y<25; y++)
       {
          for(int x=79; x>=0; x--)
          {
             if(y!=24 || x!=0)
             {
                cout << buffer[(y*80+x)*2];
             }
          }
       }
       getch();
       return 0;
    }
    Last edited by Magos; 04-03-2002 at 03:43 PM.

  13. #13
    Registered User
    Join Date
    Mar 2002
    Posts
    10
    Magos , Really Really Really Thanx About This Code , Now i want to make the user enter the array of characters he wants and then the screen flips it. Can You ?
    i'll be more Greetfull

  14. #14
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Put whatever cout-statement you want where I wrote:

    //*** Input whatever text you want here ***

    Simple, huh?

    If you want the user to do this in real-time, you have to try by yourself this time .
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 03:56 PM
  2. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 09:18 PM
  3. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  4. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 12:51 PM
  5. Console Screen Buffer
    By GaPe in forum Windows Programming
    Replies: 0
    Last Post: 02-06-2003, 04:15 AM

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