|
Post by providence4ver on Nov 28, 2002 4:45:58 GMT -5
how do you run a screen saver within the program......
how do make it go into the screen saver mode,
without pressing anything
|
|
|
Post by Smasher on Dec 11, 2002 0:06:42 GMT -5
Use a timer. Assuming you're already using getkey, you could do something simple like:
--- progam code here---- 0->C lbl ML Repeat getkey+(C=1000 // This is the main getkey loop that waits for input C+1->C End If C=1000 // If timer ran out, go to screensaver goto SS Ans->G // This stores the getkey for futher use, if there was one (if there wasn't, the program wouldn't get here) --- more program code --- // Make sure you have a goto or stop or something in the line // before lbl SS, because otherwise you'll go into the screensaver unintentionally lbl SS Repeat getkey // repeats until a key is hit --- code for one frame of screensaver --- End Goto ML // returns to main loop
Many programmers, myself included, frown on the practice of using goto's and labels. There are two reasons I use them here; 1) I don't know exactly how you structured your program, so seperating the screensaver from the main loop makes it easier to implement in your own program (and allows for the possibility of calling it from multiple places, although you'd have to rework the code a bit), and 2) As used above, the goto's don't create any memory leaks, which is one of the main problems with using them in the first place.
|
|