Thread: Movie credits sc roll

  1. #1
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688

    Movie credits sc roll

    Hi all, I was wondering if there was any way to make text scroll from the bottom to the top of the screen like the credits in movies?

    I have no real idea on this, but I thought of using Sleep() to gange the speed of the scroll. Here is my sample idea:

    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    int main()
    {
    for(;;) // use a infinate loop to make sure it only ends at a point
    {
     // other code here - including text to scroll
    
    Sleep(1400); // set the scroll speed
    
    if ( txtscll == 100) // break loop at certain point
    {
    break;
    }
    }
    
    return 0;
    }
    Please remember this is a snippit of an idea. I would really appreiciate any help or comments on how to go about this. Thanks - Pete!

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    In the console windows I'm used to, each time you output a line the rest of the lines move up. So if you start off by writing a bunch of empty lines to the screen, then each additional line will start from the bottom and work its way up. If you sleep between each line the same amount of time I'm guessing you would get the effect that you want. It won't be a smooth scroll, since all the text would jump up a line each time, but its probably the best you could do.

  3. #3
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    I have solved it using daved idea... Please use this sample if you want as a template. i have compiled it and it works perfectly ok. Just change the Sleep number to ajust the speed.

    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    int main()
    {
     	int myscroll = 0;
     	
     	for ( int i = 0; i < 30; i++ )
     	{
    	 	cout << "\n\n";
        }
     	
     	for (;;)
     	{
     		cout << "MY SCROLL" << endl;
     		
     		Sleep(100);
     		
     		myscroll++;
     		
     		if ( myscroll == 10 )
     		{
    		   	 break;
    	    }
        }
        
        getchar();
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why am I getting this error?
    By tallguy in forum C++ Programming
    Replies: 17
    Last Post: 04-02-2007, 03:34 PM
  2. movie being filmed in my town, some actors went to my restauratn
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 09-15-2003, 01:51 PM
  3. A cool French movie!!!
    By shaik786 in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 03-27-2003, 03:45 PM
  4. Memento movie
    By WayTooHigh in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 09-07-2001, 01:00 PM