News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to make "scrolling text" please?

Started by winge, July 31, 2008, 04:00:27 PM

Previous topic - Next topic

winge

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

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

winge

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

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

winge

hmmm, actually I would prefer to setup a Timer to control the speed of scrolling. ::)

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

hutch--

winge,

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

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

winge

hutch--, I appreciate your time and efford! I will learn from your sample, and understand the gerneral idea of your instructions. Thank you :lol