FB under linux feels bugged

Linux specific questions.
Post Reply
Roland007
Posts: 85
Joined: Oct 26, 2009 21:01

FB under linux feels bugged

Post by Roland007 »

Code: Select all

Dim Shared as ScreenDefaults Scherm
/* Scherm has two members: DFGColor and DBGColor as Integers */

Function init() as Boolean
    ScreenRes 640,400,32
    if ScreenPtr = 0 then
        return False
    else
        Return True
    End if
    Scherm.DFGColor = &Hc0c0c0
    /* sets default color to 192,192,192 */
End Function

/* code that starts with init follows.. */

Sub DrawWin(ByRef ID as Integer)
With Windows(ID)
Color Scherm.DFGColor /* this zero !!!!!!!
If .Focus = 2 then Color &HFFFF00
If .Focus = 1 then Color &H00FF00
    dim as String Res
    If .Focus then
        If .Resize then Res = chr(254) else Res=chr(188)
        if len(.Title) > 0 and (.Wdth > (len(.Title)+5))then 
            Locate .Y,.X : print chr(201)+chr(181)+trim(.Title)+chr(198)+string(.Wdth - (len(.Title)+4),205)+chr(187);
        else
            Locate .Y,.X : print chr(201)+string(.Wdth-2,205)+chr(187);
        end if
        Locate .Y + .High-1,.X : print chr(200)+string(.Wdth-2,205)+Res;
        For lus as integer = 1 to .High -2
            locate .Y+lus,.X : print chr(186)+string(.wdth-2,32)+chr(186);
        next
    else
        If .Resize then Res = chr(254) else Res=chr(217)
        if Len(.Title) > 0 and (.Wdth > (len(.Title)+5)) then
            Locate .Y,.X : print chr(218)+chr(180)+trim(.Title)+chr(195)+string(.Wdth - (len(.Title)+4),196)+chr(191);
        else
            Locate .Y,.X : print chr(218)+string(.Wdth-2,196)+chr(191);
        end if
        Locate .Y + .High-1,.X : print chr(192)+string(.Wdth-2,196)+Res;
        For lus as integer = 1 to .High -2
            locate .Y+lus,.X : print chr(179)+string(.wdth-2,32)+chr(179);
        next
    end if  
Color scherm.DFGColor     
end with
End Sub

Hi All,

I thought, lets give FB under Linux a look and installing wasn the issue. I do however get all kind of bugs. In the example above the screencolor becomes zero because somehow, assigning a value to a shared structure from a function fails. The result is that I need to replace the line by its actual color but this defeats the purpose of it all.

I also run in to strange errors where prints to Graphic screens or the terminal are simple never shown, where assigning integer values smaller then 254 to an UByte var type simply fails without compiler error. Result code runs, but the code is simple never reached or executed.

I am puzzled: under windows it works consistently right, under Linux not.

Anyone an idea, whats up?

Thanx
fxm
Moderator
Posts: 12106
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: FB under linux feels bugged

Post by fxm »

First error correction ('Scherm.DFGColor = &Hc0c0c0' was never executed because of 'return' before):

Code: Select all

Function init() as Boolean
    ScreenRes 640,400,32
    if ScreenPtr = 0 then
        return False
    else
        Scherm.DFGColor = &Hc0c0c0
        /' sets default color to 192,192,192 '/
        Return True
    End if
End Function
Roland007
Posts: 85
Joined: Oct 26, 2009 21:01

Re: FB under linux feels bugged

Post by Roland007 »

Wow, this is basic..... Sorry and thanxs for the wake-up.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: FB under linux feels bugged

Post by MrSwiss »

Btw. Color (32bit) is defined as ULong, to be compatible with 32/64 FB compilers.
Integer becomes 64bit with FBC64 and, it should be a *unsigned integer<32>*.
Post Reply