News:

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

Scrolling text flickers?

Started by hfheatherfox07, May 18, 2011, 09:04:04 PM

Previous topic - Next topic

hfheatherfox07

Quote from: qWord on June 05, 2011, 08:45:06 PM
Quote from: hfheatherfox07 on June 04, 2011, 08:26:04 PMStill no idea how to create the jumping sine .....
what did you mean with jumping sine? (See the attachment).
Is your problem the mathematics or measuring and placement of characters (or both)?

That is what I was looking to do.... If you don't mind me saying ...you seem like a very very good programmer, it will be many many years before I even catch up slightly..... ::)

hfheatherfox07

Quote from: qWord on June 05, 2011, 08:45:06 PM
Quote from: hfheatherfox07 on June 04, 2011, 08:26:04 PMStill no idea how to create the jumping sine .....
what did you mean with jumping sine? (See the attachment).
Is your problem the mathematics or measuring and placement of characters (or both)?

Any chance of a source?  :(

qWord

in the attachment an lib holding the function JmpSine(). A short description can be found in the include file.
(take care of used data types  :U)

qWord
FPU in a trice: SmplMath
It's that simple!

hfheatherfox07

Quote from: qWord on June 06, 2011, 03:25:07 AM
in the attachment an lib holding the function JmpSine(). A short description can be found in the include file.
(take care of used data types  :U)

qWord


Thanks this should keep me plenty busy trying to really understand the concept of what is making the sine jump and wave....  :dazzled:

qWord

Quote from: hfheatherfox07 on June 07, 2011, 12:33:39 AMreally understand the concept of what is making the sine jump and wave....  :dazzled:
Sinusoidal waves
or
Sine wave
FPU in a trice: SmplMath
It's that simple!


hfheatherfox07

Quote from: Siekmanski on June 05, 2011, 03:45:04 PM
YES !! found it...  :bg

Here are the complete sources of "HTMLencoder".
changed the music for a smaller piece else it wouldn't fit in the file.
Most of the labels are written in Dutch, if there's something you don't understand you can always ask me.
( Or you can take a course in dutch language, hahahahaha  :lol )

Veel plezier.

Thanks a lot...here is a translated version to English

Siekmanski

Funny translation, hahaha  :bg :bg

QuoteInsert Quote
Quote from: Siekmanski on June 05, 2011, 05:45:04 pm
YES !! found it... 

Here are the complete sources of "HTMLencoder".
changed the music for a smaller piece else it wouldn't fit in the file.
Most of the labels are written in Dutch, if there's something you don't understand you can always ask me.
( Or you can take a course in dutch language, hahahahaha   )

Veel plezier.


Thanks a lot...here is a translated version to English

hfheatherfox07

Quote from: Siekmanski on June 10, 2011, 12:44:59 PM
Funny translation, hahaha  :bg :bg

QuoteInsert Quote
Quote from: Siekmanski on June 05, 2011, 05:45:04 pm
YES !! found it... 

Here are the complete sources of "HTMLencoder".
changed the music for a smaller piece else it wouldn't fit in the file.
Most of the labels are written in Dutch, if there's something you don't understand you can always ask me.
( Or you can take a course in dutch language, hahahahaha   )

Veel plezier.


Thanks a lot...here is a translated version to English

It is all Google Translate ......
http://translate.google.com/#   

By the Way here is the version with your original song... I managed compressing the song a little..... and took out 21 instruments that were not used ......

http://www.megaupload.com/?d=1S3ZWV2Q

hfheatherfox07

Quote from: Siekmanski on June 05, 2011, 03:45:04 PM
YES !! found it...  :bg

Here are the complete sources of "HTMLencoder".
changed the music for a smaller piece else it wouldn't fit in the file.
Most of the labels are written in Dutch, if there's something you don't understand you can always ask me.
( Or you can take a course in dutch language, hahahahaha  :lol )

Veel plezier.


Here is a poor attempt to get just the sinescroller... I don't know what to do to initialize the scrolling??? any Ideas???...what don't I need In there???
Also I have a bunch of fonts ... that If I ever get this thing going I would like to use....but I can not find were you set the RGB (255,0,255) as the Transparent color for the font picture, also were did you set the font picture order??? what I mean is not all fonts will have certain Characters in them  If you try to use any of the fonts that I have you get misspellings .... where did you set:

fonts db " ? " ' ! # @% $ ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 1234567890", 0

mine are in a different order ...are they in one of the libs??

Siekmanski

Hi hfheatherfox07

The format is just "ASCII" format starting with "space" == (dec)32
In RadAsm you can find an "ASCII Table" on the right side of the toolbar.
Compare it with the picture and you'll understand it.

In the routine "Sinus_scroller" you can find this piece of code:


    sub    eax,32        ; ASCII value - 32   ( all values below 32 are used to control the speed etc. )
    shl    eax,5         ; chacracters are 32 pixels ( width and higth ) picture is 256 pixels  by 256 pixels ( so, 256/32=8 characters in one row )
    mov    ecx,eax       ; copy character start
    and    ecx,0ffh      ; calculate X pos
    and    eax,0ff00h    ; calculate Y pos
    shr    eax,3         ; 8 characters in one row to the next row

    mov    rcScrollFont.left,ecx  ; postion in font picture
    mov    rcScrollFont.top,eax


So, if you want to write a character just substract the value of the character with 32 and you get the right position in de font picture.

This is a fast way of getting the right position in the fontpicture.  :bg
But it only works on 256 pixel wide pictures with 32 pixel wide fonts.
( you can change the code to 8*8, 16*16 wide fonts if you want.)

The function "Set_TransparantColor" is in "common\DD_util.asm" and sets that color as the transparent color.

greetings Siekmanski

hfheatherfox07

Quote from: Siekmanski on June 22, 2011, 12:18:49 PM
Hi hfheatherfox07

The format is just "ASCII" format starting with "space" == (dec)32
In RadAsm you can find an "ASCII Table" on the right side of the toolbar.
Compare it with the picture and you'll understand it.

In the routine "Sinus_scroller" you can find this piece of code:


    sub    eax,32        ; ASCII value - 32   ( all values below 32 are used to control the speed etc. )
    shl    eax,5         ; chacracters are 32 pixels ( width and higth ) picture is 256 pixels  by 256 pixels ( so, 256/32=8 characters in one row )
    mov    ecx,eax       ; copy character start
    and    ecx,0ffh      ; calculate X pos
    and    eax,0ff00h    ; calculate Y pos
    shr    eax,3         ; 8 characters in one row to the next row

    mov    rcScrollFont.left,ecx  ; postion in font picture
    mov    rcScrollFont.top,eax


So, if you want to write a character just substract the value of the character with 32 and you get the right position in de font picture.

This is a fast way of getting the right position in the fontpicture.  :bg
But it only works on 256 pixel wide pictures with 32 pixel wide fonts.
( you can change the code to 8*8, 16*16 wide fonts if you want.)

The function "Set_TransparantColor" is in "common\DD_util.asm" and sets that color as the transparent color.

greetings Siekmanski


Sorry no clue how to initiate "Sinus_scroller proc" with out crashing.... it seems that this little demo is very intertwined .... you almost need all the procs that you wrote including size window, why is that needed ??... No luck getting just a black screen with scrolling text :(

Siekmanski

Your wish is my command.............  :bdg

OK, stripped the source at your wishes.
Now it's your turn to change the font, and it's size.

Quoteyou almost need all the procs that you wrote including size window, why is that needed ??...

It has no need but,  the user can stretch the screensize to the size they like.  ( you can remove it if you want. )


hfheatherfox07

Quote from: Siekmanski on June 24, 2011, 05:50:23 PM
Your wish is my command.............  :bdg

OK, stripped the source at your wishes.
Now it's your turn to change the font, and it's size.

Quoteyou almost need all the procs that you wrote including size window, why is that needed ??...

It has no need but,  the user can stretch the screensize to the size they like.  ( you can remove it if you want. )



Thank you so much ....
but I am at a loss about the 2 things still....

1. the ASCII table ( I am well familiar with ASCII to HEX to DEC conversion) but I do not see any were where you added the character order...
how did you declare the character pattern?...most pictures of fonts are not 8 rows by 8 columns
also I realize from your
2.previous post that the transparent color is set in :
The function "Set_TransparantColor" is in "common\DD_util.asm" and sets that color as the transparent color.

but I do not see a reference there for (255,0,255)  there.... ???

at the risk of looking dumb I just don't see it  :(

were in the program would I change the picture-font background to black as transparent for example??

and were would I declare the character order and how.... ????

Thank you and sorry again that I don't see it

Siekmanski

You have to rearrange your fontpicture according to the "ASCII TABLE"

ASCII TABLE 32 - 96 ( values used in the font picture )
8 characters per row as in the "ASCII TABLE" starting with space ( value 32 )

   ! " # $ % & '   ; 32 - 39
( ) * + , - . /   ; 40 - 47
0 1 2 3 4 5 6 7   ; 48 - 55
8 9 : ; < = > ?   ; 56 - 63
@ A B C D E F G   ; 64 - 71
H I J K L M N O   ; 72 - 79
P Q R S T U V W   ; 80 - 87
X Y Z [ \ ] ^ _   ; 88 - 95

All characters are 32 * 32 pixels ( fontpicture has to be 256 * 256 )

Let's say we want to write "M"
"M" has the value 77

We need to calculate the offset of "M" in the fontpicture to cut it out and copy it in
the scrollscreen.

First substract 32 from 77 because our characters start with "SPACE" which is equal to 32

Let's do the calculations:

77 - 32 = 45
45 * 32 (character width) = 1440 ( keep a copy of 1440 to calc X position )
Y position == 1440 and 0ff00h = 1280 / 8 (characters in a row) = 160
X position == 1440 and 0ffh = 160

Cut out the M at left-top pixelposition 160,160 in the font picture ( 32 * 32 pixels )

all is done in this piece of code:

    sub    eax,32        ; ASCII value - 32   ( all values below 32 are used to control the speed etc. )
    shl    eax,5         ; chacracters are 32 pixels ( width and higth ) picture is 256 pixels  by 256 pixels ( so, 256/32=8 characters in one row )
    mov    ecx,eax       ; copy character start
    and    ecx,0ffh      ; calculate X pos
    and    eax,0ff00h    ; calculate Y pos
    shr    eax,3         ; 8 characters in one row to the next row

    mov    rcScrollFont.left,ecx  ; postion in font picture
    mov    rcScrollFont.top,eax

   etc......


; Initialisation of the background color and de tranparent color are done here:

Load_AllPictures proc

   invoke   Load_Picture,SinusFont,addr g_pSinusFont

   mov      eax,dwWindow_Width
   add      eax,32
   invoke   Create_Surface,eax,32,addr g_pDDSScrollScherm

   mov      ddBack_bltfx.dwFillColor,RGB(0,0,64) ; set the background color of the scrollscreen and the backbufferscreen ( they use the same struct )
   coinvoke g_pDDSScrollScherm,IDirectDrawSurface7,Blt,NULL,NULL,NULL,DDBLT_COLORFILL or DDBLT_WAIT,addr ddBack_bltfx

   invoke   Set_TransparantColor,g_pDDSScrollScherm,RGB(255,0,255) ; set the transparent fontcolor ( in this case it's pink )

   etc......

RenderDD proc hwnd:DWORD

;  clear backbuffer with your background color....
   coinvoke g_pDDSBack,IDirectDrawSurface7,Blt,NULL,NULL,NULL,DDBLT_COLORFILL or DDBLT_WAIT,addr ddBack_bltfx

   invoke   Sinus_scroller

   etc......




If you want to use other fonts with other offsets you need to make a look up table.....