Closing Credits

Post your FreeBASIC tips and tricks here. Please don’t post your code without including an explanation.
nimdays
Posts: 196
Joined: May 29, 2014 22:01
Location: ID

Closing Credits

Postby nimdays » Sep 09, 2018 3:53

This is about Closing Credits, and since my English is not that good , You can read about it from wikipedia

Code: Select all

const w = 800,h = 600,bpp = 32,d = 20, sep = 58 ''d = vertical distance, sep = separator
dim as integer x,y = h + d '' from the bottom
dim as string s(...) = {"CAST","",_
"Father : Bradd Pid","Mother : Angelina Jody",_
"Son : Matt Demon","Daughter : Emmy Stone",_
"","","VFX","Blah Blah Blah",_
"","","Sound","Blah Blah Blah",_
"","","","","","","","","","","The End"}

screenres w,h,bpp

do
    if y + ubound(s)* d < h/2 then exit do '' until the last string
    screenlock
    cls '' clear it
    for i as integer = 0 to ubound(s)
        if s(i) = "" then continue for '' ignore the blank string
        dim as integer p =  y + i * d '' v position 
        dim as integer c = instr(s(i),chr(sep)) ' find the separator
        dim as ubyte col = p '' for the text color/fading effect
        if p > 255 then
          col = 255 '' white color
        elseif p < 0 then
          col = 0 '' black color
        end if
        if c then
          x = w/2 - c*8 '' in the center - the separator
          s(i)[c-1] = 32 '' replace the separator with a space
        else
          x = (w-len(s(i))*8)/2 '' in the center of the screen
        end if
        draw string(x,p),s(i),rgb(col,col,col) '' draw the text
        if c then s(i)[c-1] = sep ' restore the separator back
    next
    screenunlock
    sleep 20,1
    y -= 1 '' decrease the counter
loop until len(inkey)

sleep


Postimg.org is offline at the moment, I might upload the image later.

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 3 guests