Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: bikerboy on January 04, 2009

Title: scroller help :)
Post by: bikerboy on January 04, 2009
hey guys  :D

i'm trying to create a little something using this example here -> http://www.dbfinteractive.com/forum/index.php/topic,3788.0.html

but i don't know how to create a simple scroller to work with that example

can anyone show me how to create one? :)

thanx :D
Title: Re: scroller help :)
Post by: DrewPee on January 04, 2009
All i can say is find some of shockwaves code . . . his scroller routine is superb! and very easy to understand!
Title: Re: scroller help :)
Post by: DrewPee on January 04, 2009
Here you go . . .

Shockwaves framework . . . simply superb!

http://www.dbfinteractive.com/forum/index.php?topic=1455.0
Title: Re: scroller help :)
Post by: bikerboy on January 04, 2009
cheers man :D  :cheers:

i was looking for that one  :P but somehow didn't manage to find it :o

lol i need more sleep
Title: Re: scroller help :)
Post by: Shockwave on January 05, 2009
As drewpee said, you can just use the framework if you are looking for an easy solution to drawing text.

But.. you are limited to the font that I drew for that framework, if you are going to use the graphics template then that is also possible and not too tricky.

The scrollers I have seen you writing so far just print a long string of text which is ok if you want only a little bit of scroll text but what if you had say... 20kb of scroll text like in the old days?

A few things have to be considered to write a bitmap scroller and there are more than a few ways of doing it too.

First thing you need to read up on is the mid command.

Mid simply returns part of a string.

slice = mid ( scroll , startpos, width )

Where startpos is the position inside the string and width is the amount of characters to chop out.

You are going to have to do this no matter what method you use, I've added the (cheap and lame in my opinion) way of doing it below;

Code: [Select]

        #INCLUDE "TINYPTC_EXT.BI"
        #INCLUDE "windows.bi"

'-------------------------------------------------------------------------------       
'       ALL VARIABLES MUST BE DECLARED.
'-------------------------------------------------------------------------------       

        OPTION STATIC
        OPTION EXPLICIT

'-------------------------------------------------------------------------------       
'       SCREEN DIMENSIONS.
'-------------------------------------------------------------------------------       

        CONST   XRES = 640:'    WIDTH
        CONST   YRES = 480:'    HEIGHT
       
        DECLARE SUB TEXT(BYVAL BX AS INTEGER , BYVAL BY AS INTEGER , BYVAL WW AS STRING , BYVAL WR AS INTEGER, BYVAL WG AS INTEGER, BYVAL WB AS INTEGER)
        DECLARE SUB READFONT()
       
       
'-------------------------------------------------------------------------------       
'       SCROLL TEXT VARIABLES;
'-------------------------------------------------------------------------------       
'       NEEDS SOME BLANK SPACES AT THE START TO AVOID TEXT JUST APPEARING
        DIM SHARED SCROLL AS STRING
        SCROLL="                                                                        "
        SCROLL=SCROLL+"ADD YOUR SCROLLTEXT HERE...........   MKAY?"
        SCROLL=SCROLL+""
        SCROLL=SCROLL+""

'       CONVERT TO CAPS;
        SCROLL=UCASE(SCROLL)
'       SCROLL POINTER;       
        DIM SHARED AS INTEGER SP = 1     
'       SCROLL OFFSET (USE DOUBLE FOR DELTA TIMING TO AVOID STUPID SPEEDS);       
        DIM SHARED AS DOUBLE SO = 0
        DECLARE SUB SCROLLTEXT()
       
'-------------------------------------------------------------------------------       
'       "LOAD" FONT
'-------------------------------------------------------------------------------       

        DIM SHARED AS UINTEGER BUFFER ( XRES * YRES )       
        DIM SHARED FONT (64 * 64) as Uinteger : ' FONT BUFFER
        READFONT()

'-------------------------------------------------------------------------------       
'       OPEN THE SCREEN
'-------------------------------------------------------------------------------       

        PTC_ALLOWCLOSE(0)
        PTC_SETDIALOG(1,"PLEASE CHOOSE"+CHR$(13)+"FULL SCREEN?",0,1)               
        IF (PTC_OPEN("by Shockwave",XRES,YRES)=0) THEN
        END-1
        END IF   


        DIM SHARED AS DOUBLE OLD,DV
'-------------------------------------------------------------------------------       
'       THE MAIN LOOP;
'-------------------------------------------------------------------------------       

while GetAsyncKeyState(VK_ESCAPE)<>-32767
            OLD=TIMER
            SCROLLTEXT()
            PTC_UPDATE @ BUFFER (0)
            ERASE BUFFER
            SLEEP 1
            DV=TIMER-OLD
wend

SUB SCROLLTEXT()
    TEXT( SO , YRES/2 , MID(SCROLL,INT(SP),80), 255, 255, 255)
    SO=SO-(DV*90)
    IF SO<-8 THEN
        SP=SP+1
        IF SP>LEN(SCROLL) THEN SP=1
        SO=SO+8
    END IF
END SUB

'-------------------------------------------------------------------------------
' CUSTOM GRAPHICS SUBS;
'-------------------------------------------------------------------------------


sub TEXT(BYVAL BX AS INTEGER , BYVAL BY AS INTEGER , BYVAL WW AS STRING , BYVAL WR AS INTEGER , BYVAL WG AS INTEGER , BYVAL WB AS INTEGER)
'
' Usage : TEXT ( X , Y , "YOUR TEXT" , R , G , B )
'
'

WW = UCASE (WW)

dim blx,bly as Uinteger

DIM as INTEGER STRX,STRY,TLP,TC,CH

    TC =RGB (WR , WG , WB)
   
    dim bm,mm
   
    FOR TLP = 0 TO LEN(WW)
    CH = ASC(MID(WW,TLP,1))-31
    IF CH<0 OR CH>64 THEN CH=0
    '---------------------------------
    'Calculate Offset In Font Data;---
    '---------------------------------
    bm=(ch*64)-64
   

    STRY=BY
   
    FOR BLY=0 TO 7   
    STRX=BX + ((TLP-1) * 9)
   
    FOR BLX=1 TO 8
        '--------
        'Clip;---
        '--------                   
            '----------------------------------------------------
            'Draw Pixel In Buffer If Onscreen And If Binary 1 ---
            '----------------------------------------------------
            MM= FONT((((BLY)*8)+(BLX))+BM)                       
                IF (STRX>0) AND (STRX<XRES)  THEN             
                IF MM >0 THEN
                    BUFFER (((STRY)*XRES)+STRX) = TC

                end if
                END IF 
                STRX=STRX+1               
    NEXT
    STRY=STRY+1
    NEXT
    NEXT
END SUB




SUB READFONT()
        dim lp
        FOR LP=1 TO (64*64)
                READ FONT(LP)
        NEXT
       
END SUB

'space
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0

'!
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0

' "
data 0,1,1,1,0,1,1,1
data 0,1,1,1,0,1,1,1
data 0,1,1,1,0,1,1,1
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0

' #

data 0,0,0,0,0,0,0,0
data 0,1,1,1,0,1,1,0
data 1,1,1,1,1,1,1,1
data 0,1,1,1,0,1,1,0
data 0,1,1,1,0,1,1,0
data 1,1,1,1,1,1,1,1
data 0,1,1,1,0,1,1,0
data 0,0,0,0,0,0,0,0

' $ = £
data 0,0,1,1,1,1,1,0
data 0,1,1,1,0,1,1,1
data 1,1,1,1,1,0,0,0
data 0,1,1,1,0,0,0,0
data 0,1,1,1,0,0,0,0
data 0,1,1,1,0,0,0,0
data 0,1,1,1,0,0,0,0
data 1,1,1,1,1,1,1,1

' %
data 0,0,0,0,0,0,0,0
data 0,1,1,0,0,1,1,1
data 0,1,1,0,1,1,1,0
data 0,0,0,1,1,1,0,0
data 0,0,1,1,1,0,0,0
data 0,1,1,1,0,1,1,0
data 1,1,1,0,0,1,1,0
data 0,0,0,0,0,0,0,0
' & = O
data 0,0,0,1,1,0,0,0
data 0,1,1,1,1,1,1,0
data 0,1,1,1,1,1,1,0
data 1,1,1,1,1,1,1,1
data 1,1,1,1,1,1,1,1
data 0,1,1,1,1,1,1,0
data 0,1,1,1,1,1,1,0
data 0,0,0,1,1,0,0,0
' '
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0

' (
data 0,0,1,1,1,1,0,0
data 0,1,1,1,1,0,0,0
data 0,1,1,1,0,0,0,0
data 0,1,1,1,0,0,0,0
data 0,1,1,1,0,0,0,0
data 0,1,1,1,0,0,0,0
data 0,1,1,1,1,0,0,0
data 0,0,1,1,1,1,0,0
' )
data 0,0,1,1,1,1,0,0
data 0,0,0,1,1,1,1,0
data 0,0,0,0,1,1,1,0
data 0,0,0,0,1,1,1,0
data 0,0,0,0,1,1,1,0
data 0,0,0,0,1,1,1,0
data 0,0,0,1,1,1,1,0
data 0,0,1,1,1,1,0,0

' *
data 0,0,0,0,0,0,0,0
data 0,1,0,1,1,0,1,0
data 0,0,1,1,1,1,0,0
data 0,1,1,1,1,1,1,0
data 0,1,1,1,1,1,1,0
data 0,0,1,1,1,1,0,0
data 0,1,0,1,1,0,1,0
data 0,0,0,0,0,0,0,0

' +
data 0,0,0,0,0,0,0,0
data 0,0,0,1,1,0,0,0
data 0,0,0,1,1,0,0,0
data 0,1,1,1,1,1,1,0
data 0,1,1,1,1,1,1,0
data 0,0,0,1,1,0,0,0
data 0,0,0,1,1,0,0,0
data 0,0,0,0,0,0,0,0
' ,
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,1,1,1,1,0,0

' -
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,1,1,1,1,1,1,0
data 0,1,1,1,1,1,1,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
' .
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,1,1,0,0,0
data 0,0,0,1,1,0,0,0
' /
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,1,1,1
data 0,0,0,0,1,1,1,0
data 0,0,0,1,1,1,0,0
data 0,0,1,1,1,0,0,0
data 0,1,1,1,0,0,0,0
data 1,1,1,0,0,0,0,0
data 0,0,0,0,0,0,0,0

'0
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,1,0,1,1,1
data 1,1,1,0,1,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
'1
data 0,0,0,1,1,1,0,0
data 0,0,1,1,1,1,0,0
data 0,0,1,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,1,1,1,1,1,0
'2
data 0,0,1,1,1,1,1,0
data 0,1,1,1,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,1,1
data 1,1,1,1,1,1,1,1
'3
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 0,0,0,0,1,1,1,0
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
'4
data 1,1,1,0,1,1,1,0
data 1,1,1,0,1,1,1,0
data 0,1,1,1,1,1,1,1
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
'5
data 1,1,1,1,1,1,1,0
data 1,1,1,0,1,1,1,0
data 1,1,1,0,0,0,0,0
data 0,1,1,1,1,1,1,0
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
'6
data 1,1,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0
data 1,1,0,0,0,0,0,0
data 1,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
'7
data 1,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 0,0,0,0,1,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
'8
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
'9
data 0,1,1,1,1,1,1,1
data 1,1,0,0,0,1,1,1
data 0,1,1,1,1,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1

' :
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,1,1,1,1,0,0

' ;
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0

' <
data 0,0,0,0,0,0,0,0
data 0,0,1,1,1,0,0,0
data 0,1,1,1,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 0,1,1,1,0,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,0,0,0,0,0,0

' =
data 0,0,0,0,0,0,0,0
data 0,0,1,1,1,1,0,0
data 0,0,1,1,1,1,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,1,1,1,1,0,0
data 0,0,1,1,1,1,0,0
data 0,0,0,0,0,0,0,0

' >
data 0,0,0,0,0,0,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,0,1,1,1,0
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,1,1,1,0
data 0,0,0,1,1,1,0,0
data 0,0,0,0,0,0,0,0

' ?
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 0,0,0,1,1,1,1,0
data 0,0,0,1,1,1,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,1,1,1,0,0

' @
data 0,0,0,0,0,0,0,0
data 0,0,1,1,1,1,0,0
data 0,1,1,0,0,1,1,0
data 0,1,0,1,1,0,1,0
data 0,1,0,0,0,0,1,0
data 0,1,0,1,1,0,1,0
data 0,0,1,1,1,1,0,0
data 0,0,0,0,0,0,0,0

'[]\^_?@

'A
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,1,1,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
'B
data 1,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,1,1,1,1,0
'C
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
'D
data 1,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,1,1,1,1,0
'E
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,1,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
'F
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,1,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0

'G
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,1,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0

'H
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,1,1,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1

'I
data 0,1,1,1,1,1,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,1,1,1,1,1,0,0
'J
data 0,1,1,1,1,1,1,1
data 1,1,1,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 1,1,1,1,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
'K
data 1,1,1,0,1,1,1,0
data 1,1,1,0,1,1,1,0
data 1,1,1,1,1,1,0,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
'L

data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0

'M

data 0,1,1,0,1,1,1,0
data 1,1,1,1,1,1,1,1
data 1,1,1,1,0,1,1,1
data 1,1,1,1,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1

'N

data 1,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1

'O
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
'P

data 1,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,1,1,1,1,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0

'Q
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,1,0,1,1
data 1,1,1,0,1,1,0,1
data 1,1,1,0,0,1,1,0
data 0,1,1,1,1,1,1,0


'R

data 1,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
'S

data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,0,0,0
data 0,1,1,1,1,1,1,0
data 0,0,0,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0

'T
data 1,1,1,1,1,1,1,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,1,1,1,0,0,0
'U
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0

'V

data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,0,0,1,1,0
data 0,0,1,1,1,1,0,0

'W
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,1,0,1,1,1
data 1,1,1,1,0,1,1,1
data 1,1,1,1,0,1,1,1
data 0,1,1,1,1,1,1,0

'X
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1

'Y
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 1,1,1,0,0,1,1,1
data 0,1,1,1,1,1,1,0

'Z
data 0,1,1,1,1,1,1,1
data 1,1,1,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,1,1,1,1,1,1,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,1,1,1
data 1,1,1,1,1,1,1,0

'[
data 1,1,1,1,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 1,1,1,1,0,0,0,0
'\
data 1,1,0,0,0,0,0,0
data 1,1,1,0,0,0,0,0
data 0,1,1,1,0,0,0,0
data 0,0,1,1,1,0,0,0
data 0,0,0,1,1,1,0,0
data 0,0,0,0,1,1,1,0
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,0,1,1
']
data 0,0,0,0,1,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,0,1,1,1
data 0,0,0,0,1,1,1,1
'^
data 0,0,0,1,1,0,0,0
data 0,0,1,1,1,1,0,0
data 0,1,1,0,0,1,1,0
data 1,1,1,0,0,1,1,1
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0

'_
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0
data 0,1,1,1,1,1,1,0

Two points..

Don't bother asking me to convert that to fb 2.04 or whatever
Don't bother asking for an exe, it's not worth seeing.

But we can glean some things from that sucky piece of code.

1: all the letters are the same width
2: CH = ASC(MID(WW,TLP,1))-31     <--Taken from the text routine.

There is a standard way of setting out alphanumeric characters called ascii. This is a universal standard and was devised to allow files to be compatble accross all kinds of computers.

Here's the table I use;

http://www.asciitable.com/ (http://www.asciitable.com/)

You will see that below 32 (space) the characters are not useful to us.

So if we draw our bitmap font, all letters the same width and lay them out in the order of that ascii table we can get to the position on the template with a simple calculation;

POS = (ASC(MID(SCROLL, POINTER ,1 ))-31) * LETTERWIDTH

From that I think you will be able to put a proper bitmap gfx scroll together, a copy and paste of my example would be a lame and sucky thing to do and I suspect it would earn you no kudos.

What would be really cool would be to try and get a real bitmap font into something you are making.. It may take you a while and you'll probably have a lot of questions to ask but I think you'll find it quite satisfying (and face it, it's a routine you will need to do at some stage ;) )
Title: Re: scroller help :)
Post by: DrewPee on January 05, 2009
Nice answer Shockwave - very useful code too!
Title: Re: scroller help :)
Post by: bikerboy on January 05, 2009
Quote
Don't bother asking me to convert that to fb 2.04 or whatever

no need to , i have solved the option static option explicit thingie error :)

Quote
From that I think you will be able to put a proper bitmap gfx scroll together, a copy and paste of my example would be a lame and sucky thing to do and I suspect it would earn you no kudos.

what i'm seeking is not to copy others, i never liked copying people anyways.
what i seek is knowledge and steady but solid growth in coding by learning from examples like this one you posted  :cheers:
Quote
What would be really cool would be to try and get a real bitmap font into something you are making..

you mean like take a bitmap font and use it right?

Quote
It may take you a while and you'll probably have a lot of questions to ask but I think you'll find it quite satisfying (and face it, it's a routine you will need to do at some stage Wink )

it's ok i have patience in learning :D
i may be learning slowly for the standards of someone who allready knows how to code properly, but i grow in coding with baby steps, i repeat several times an example so i could memorise it, understand it, and or add something to it.

that's why i have posted several intros at the showcase, not to show off or something but for the above reason and some comments that could improve me  :D

anyways i'll go now and study your example and try to make something based on that :stirrer:

thanx again for all your help :cheers:

EDIT: attached is what i'm working on and what i've managed to do so far :D
Title: Re: scroller help :)
Post by: Shockwave on January 05, 2009
Nice idea :)

What other things do you have planned apart from the stars?
Title: Re: scroller help :)
Post by: bikerboy on January 05, 2009
for now all i have planned next is to add a scroller with some nice colored letters, but in order to do that i must first learn how to use .bmp fonts in a scroller (how to make the scroller read the font.

after that i could think of something moving in the center, a classic effect.

also i'll change the asus logo with another one (that was me testing). i'll change the blue lines too.

at the moment all i can do is what you saw and try to learn the scroller code :)
after that i'll learn something new to move on :D
Title: Re: scroller help :)
Post by: Shockwave on January 05, 2009
for now all i have planned next is to add a scroller with some nice colored letters, but in order to do that i must first learn how to use .bmp fonts in a scroller (how to make the scroller read the font.

Well, as you have already got a routine for drawing slices of bitmaps it's simply a matter of getting your font laid out in ascii order ( see attached example - taken from Fairlight ducktales cracktro ) .

Then your scroll text routine simply needs to calculate where each letter is on the template picture (I gave you the code above).

:)
Title: Re: scroller help :)
Post by: bikerboy on January 05, 2009
ok let's see if o got this right, if i am to make a font or use an existing one then the letters must be in the order they appear in fairlight.png?

i noticed it's a .png and not a .bmp

bmp2raw converts png's too?

and a last question, if i attempt to make my own font, what should i notice?

the letter size? the image dimentions?
Title: Re: scroller help :)
Post by: Shockwave on January 05, 2009
it is better for you to have the font in ascii order like I showed you because...

The

ASC

Command returns the ascii number of a character, so;

num= asc (mid(scrolltext,1,1))

Would return the ascii number of the character at the start of the string.
Therefore you can multiply that number by the width of the letter in pixel to get you to the right place to start drawing from.

Don't forget that the first 31 characters are useless and useful ascii starts at chr 32 so you'll need to do this;

pos = ((asc (mid(string , stringpos , 1)))-31) * width of letter

bmp2raw converts bitmaps, not pngs.

it's attached as a png because the forum doesnt allow bmps.
Title: Re: scroller help :)
Post by: hellfire on January 05, 2009
This reminds me that I once did some tool to create bitmaps from truetype-fonts and to export char-size, -spacing and -hinting:
(http://www.abload.de/img/fontmakeremv0.jpg)
If that's useful for anyone...
Title: Re: scroller help :)
Post by: Dr.Death on January 06, 2009
Sounds helpfull hellfire could you upload it for us please m8??
Title: Re: scroller help :)
Post by: bikerboy on January 06, 2009
@Shockwave

very interesting :D thanx for the handfull of knowledge

does it matter if i make the image height more than 16 or 32? or does it have to be a specific size?

@hellfire

a very helpfull proggie man :cheers:
Title: Re: scroller help :)
Post by: Shockwave on January 06, 2009
does it matter if i make the image height more than 16 or 32? or does it have to be a specific size?

The letters can be any size as long as they are all the same size (for ease of use). You could use proportional fonts but stick to fixed width ones at first.
Title: Re: scroller help :)
Post by: bikerboy on January 06, 2009
does it matter if i make the image height more than 16 or 32? or does it have to be a specific size?

The letters can be any size as long as they are all the same size (for ease of use). You could use proportional fonts but stick to fixed width ones at first.

perfect :D i'll give it a shot at creating a .bmp font for this intro to use it with the scroller

but first i'll go study the scroller code ;)

i also updated some gfx , rar attached
Title: Re: scroller help :)
Post by: Dr.Death on January 07, 2009
Nice star field inside the laptop bikerboy  :clap:

Was it self drawn??

Title: Re: scroller help :)
Post by: bikerboy on January 07, 2009
nope it uses pixels from the laptop image :D

EDIT: is this font useable?
Title: Re: scroller help :)
Post by: DrewPee on January 07, 2009
I like what you are doing with the background image and the starfield - very clever!

The font would be useable but after just a quick look it looks to me like it isn't proportional, i.e. the characters are all different sizes - what you could do with (to paraphrase Shockwave) is fixed width really - it would be much easier to use for a start?

DrewPee
Title: Re: scroller help :)
Post by: AnimalMother on January 07, 2009
And Space is missing in front of !  ;)
Title: Re: scroller help :)
Post by: bikerboy on January 07, 2009
@drew

thanx man :D

yes the ()[] and some others are bigger , i'll try to fix them

@animal

i did put a space in front of ! it's not visible , unless i did it the wrong way ???

EDIT: typos
Title: Re: scroller help :)
Post by: AnimalMother on January 07, 2009
Well, I think you misunderstood me  ;)

Shockwave´s routine copies quads with a fixed size for each character from the whole font. Space would be the first quad ! the second etc. So every character should have the size of for example 16x16

Here you can see what I mean -> http://jerome.jouvie.free.fr/OpenGl/Tutorials/Tutorial20.php
Title: Re: scroller help :)
Post by: bikerboy on January 07, 2009
yes you are right i get it now ;)

the whole font needs fixing :)

EDIT: attached is a small progie i've found while browsing a backup.

it makes fonts in the correct ASCII order, and it reads the fonts from your system to do it.

i hope it's usefull to someone :)