LB Booster
Programming >> BASIC code examples >> Speeding up LBB graphics
http://lbb.conforums.com/index.cgi?board=code&action=display&num=1445035700

Speeding up LBB graphics
Post by Richard Russell on Oct 16th, 2015, 10:48pm

Sometimes LBB's graphics output is slower than LB's, and this Wiki article explains how that can often be resolved. A program posted by John Fisher at the Just BASIC forum illustrates this very well. The version published there runs noticeably more slowly in LBB than in LB, but if you modify it as below - i.e. create one long GUI command string - it runs more quickly in LBB:

Code:
    nomainwin

    UpperLeftX   =  20
    UpperLeftY   =  20
    WindowWidth  = 550
    WindowHeight = 570

    dim grid( 25, 25)

    for x =0 to 24
        for y =0 to 24
            grid( x, y) =int( 2 *rnd( 1))
        next y
    next x

    open "Show 2D array" for graphics_nsb as #wg

        #wg "trapclose [quit]"

        #wg "color white"
        gui$ = "down ; fill 60 60 60"

        for x =0 to 24
            for y =0 to 24
                gui$ += ";backcolor "
                if grid( x, y)=0 then gui$ += "black" else gui$ += "white"
                gui$ += ";place "; 20 +20 *x; " "; 20 +20 *y
                gui$ += "; boxfilled "; 20 +20 *x +16; " "; 20 +20 *y +16
            next y
        next x
        #wg gui$

        wait

[quit]
    close #wg
    end 

Of course this version is LBB-specific by virtue of the += operators. If you want to make it LB compatible you will need to substitute gui$ = gui$ +

Richard.