News:

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

Text in ASM

Started by FlySky, July 31, 2007, 12:44:30 PM

Previous topic - Next topic

FlySky

Hey there guys,

I have some text showed on my screen. But I am trying to play with it so I can do animated text like first it shows my first line of text I defined and after a few seconds it pops of the first line I defined and shows the second line of text I defined. How would I do that. Anyone can tell me what the steps are I should take?

Thanks in advance

Tedd

1. Draw first line of text
2. 'Sleep' some number of milliseconds (1000 milliseconds = 1 second) -- there is a function named Sleep that you can call :wink
3. Draw second line of text
4. Sleep...

Depending on the drawing mode, you might need to blank out the previous line of text before drawing the next one (especially if it is shorter).
If this is in text mode (console) you can just fill the line with spaces. In graphics mode (a window) it's probably easiest to draw a rectangle (guess the name of the function :wink) to blank it out again.

If you're looking to animate as in have the text scroll/rise onto the screen then its starts getting a little more difficult, but the idea is actually the same, except you draw the text in its new position after blanking out the previous (then sleep a short time, blank, move, until it reaches its final poistion, sleep a longer time, then do the same ofr the next line of text.)
No snowflake in an avalanche feels responsible.

FlySky

Hey there Tedd,

I really like your answer man, I didn't even think about the sleep API to use. I am going to play around to check out what kind of results I get. Thanks again for your answer, it's nicely explained.

Jackal

The first thing i thought of is to use a timer. You may try that to. Also if you want it to scroll i have an example i can give to you.

FlySky

Hey Jackal,

Thx for your reply, I would love to see your example on the scrolling so I can examine the code.

Jackal

#5
Ok this scrolls text vertically by createing a DC in memory and using a timer to copy it to the apps dc in a new position. This was a test and development for part of the about screen in one of my programs i recently wrote. Theres no comments in it but if you have any questions ask.. Also the reason i split the text in two variables is for the colors and the way i did it made it so i only had to change the color once instead of changing back and forth. Some place i have one that scrolls from right to left but you could do it this same way and just change the location in the bitblt.

[attachment deleted by admin]