Screen refresh

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Dom Red
Newbie
Posts: 1
Joined: Fri Jun 03, 2005 12:31 am

Screen refresh

Post by Dom Red » Fri Jun 03, 2005 12:34 am

can someone help me, how can I stop the screen flickering :oops:
Beauty is in the eye of the beer holder

User avatar
Levi
Veteran
Posts: 79
Joined: Tue Jul 27, 2004 11:44 pm
Location: Alone and forgotten
Contact:

Post by Levi » Fri Jun 03, 2005 1:17 am

Ummmm....there was this packet balled QBME that I downloaded once. It had something on flicker free animation. It went into topics like screen pages, copying a background page to the visible page to eliminate flicker. And waiting for the screen refresh before clearing and changing graphics.

Ah, I think I had originally found it at qbasic.com in it's files section. Let me see if it's there.

Nope, not there. Hmmm....Oh wait...Yup I was right. On the site QB45.com just go to their tutorials section and look under graphics. The sprite, Mallard, and flicker tutorials are all good ones to learn from. As well as the many others.
Later days,
Matthew

May those who love us love us
And those who don't
May the good Lord turn their hearts
And if he doesn't
May he turn their ankles
So we'll know them by their limping
-Irish prayer

User avatar
Pete
Site Admin
Posts: 882
Joined: Sun Dec 07, 2003 9:10 pm
Location: Candor, NY
Contact:

Post by Pete » Fri Jun 03, 2005 5:52 am

Here's a short tutorial that will probably answer your question:
Waiting For the Verticle Retrace
-HAL_8900

I know every single person out there has at one time download some QB-Game that has TERRIBLE flicker. This is caused by the program running too fast for the monitor to keep up...
there's one simple way to eliminate this problem..... wait for the verticle retrace on the monitor!

Now, before everyone goes "Ungh? WAIT? I want my program to be FAST!" you need to understand, WAITing for the verticle retrace doesn't slow down the program all that much (after all, it's a hardware thing) and the delay will be imperceptable (sp?). Also, you can add this without having to rewrite your entire program.... here's and example:

Code: Select all

SUB ANIMATE
DO
WAIT &H3DA, 8
PUT (x,y), sprite<----Assuming that sprite has already been BLOADED and GET-ed(GET-ed ehehe)
x=x+1
LOOP
Now, of course, with this program, you'll have a long line of sprites when you run it, but implement the command:

Code: Select all

WAIT &H3DA, 8
on any animation thats flickery and it should stop (or reduce) the flicker....

Now, this wont ALWAYS work...

On really fast machines, this algorithm will work sometimes, at best, but on 486's and Lower-End (66mhz-120 mhz) pentiums, this will produce fantastic results!

YUP! THAT'S IT!!!!!

User avatar
Deleter
Veteran
Posts: 119
Joined: Sat May 07, 2005 7:31 pm

Post by Deleter » Fri Jun 03, 2005 2:15 pm

thats the method I use, but I have a real fast computer and it still flickers a bit...is there any solution for this?

User avatar
Xerol
Veteran
Posts: 81
Joined: Tue Jan 04, 2005 6:27 pm
Location: Timonium, MD
Contact:

Post by Xerol » Fri Jun 03, 2005 4:16 pm

Well, if possible, use FreeBasic, which has inherent page-copying, and therefore flickerless graphics.
If you need music composed in MP3, WAV, or MIDI format, please contact me via email.

Xerol's Music - Updated Regularly!

User avatar
Deleter
Veteran
Posts: 119
Joined: Sat May 07, 2005 7:31 pm

Post by Deleter » Fri Jun 03, 2005 5:14 pm

I am using freebasic. and I am using the screenset command<-bad idea?

edit: damn...screencopy does eliminate flicker....but it also cuts my fps...help?

User avatar
Xerol
Veteran
Posts: 81
Joined: Tue Jan 04, 2005 6:27 pm
Location: Timonium, MD
Contact:

Post by Xerol » Fri Jun 03, 2005 6:03 pm

It'd probably be helpful if you posted some code. Take a look at Bombard!, and see how that runs. I get around 101 fps most of the time, and wrote a little function to handle the screen copying, clearing the keyboard buffer, and displaying the current FPS.
If you need music composed in MP3, WAV, or MIDI format, please contact me via email.

Xerol's Music - Updated Regularly!

Post Reply