The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: winge on July 31, 2008, 04:00:27 PM

Title: How to make "scrolling text" please?
Post by: winge on July 31, 2008, 04:00:27 PM
For a year, I saw some interesting program had the "scrolling text" effect on it (words flying from right <-> left). I tried to figure it out myself for many times, but failed.

Would some body kindly share some knowledge on this with me please? Even just a basic example, would be truly appreciated! Thank you in advanced ...  :red
Title: Re: How to make "scrolling text" please?
Post by: hutch-- on August 01, 2008, 02:58:18 AM
If you have a copy of one of my editors, TopGun, start the about box, hold the Shift key and click on OK and the screen will scroll right until it comes back to normal.

Its done by creating a large in memory bitmap of 2 copies of the screen then using BilBlt to shift from one to the other. Sounds messy but its no big deal to do. You can use this method to scroll in any direction, up downm left right depending on how you create he bitmap.
Title: Re: How to make "scrolling text" please?
Post by: winge on August 01, 2008, 03:21:11 AM
Thank you for your reply, hutch-- ! I saw the effect on the topgun.exe as well as your sample code in the tour. section ... It' was fun, but would that be possible that you can share 1 more example that only "text" (not dib) moving in a normal window please?  :P
Title: Re: How to make "scrolling text" please?
Post by: hutch-- on August 01, 2008, 03:47:25 AM
Have a look at the API DrawText() and move the text by changing the coordinates of the rectangle it is confined to. It would probably be easier to draw the text on a bitmap then scroll it as before with BilBlt() but you could give it a try. It may be a bit flickery with pure text where BilBlt() will be much smoother.

the technique in TopGun is to test video cards for their fill rate, the smoother the scroll is, the faster the fill rate.
Title: Re: How to make "scrolling text" please?
Post by: winge on August 01, 2008, 04:49:27 AM
hmmm, actually I would prefer to setup a Timer to control the speed of scrolling. ::)
Title: Re: How to make "scrolling text" please?
Post by: hutch-- on August 01, 2008, 06:15:49 AM
A timer would be normal as long as the interval is over about 20ms, the idea of using a back bufer for the text is so you get no flickering with the BitBlt() operation where you may get flickering with just text display written directly to the client area.
Title: Re: How to make "scrolling text" please?
Post by: hutch-- on August 01, 2008, 01:50:04 PM
winge,

Here is a simple example of how to scroll text in the client area of a Window.

[attachment deleted by admin]
Title: Re: How to make "scrolling text" please?
Post by: winge on August 01, 2008, 02:24:51 PM
hutch--, I appreciate your time and efford! I will learn from your sample, and understand the gerneral idea of your instructions. Thank you :lol