Qbasicnews.com

Full Version: Newest gfxlib CVS snapshot (updated 5/2/2005)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Here you go:

http://www.ecplusplus.com/index.php?page...fxlib2.zip

Holds latest gfxlib CVS snapshot compiled for Win32, together with latest documentation. Just overwrite the libfbgfx.a in your freebasic/lib/win32 directory with the one shipped within this package.

Differences from the gfxlib shipped with FB 0.11:

- New GDI driver for Win32; this is used automatically if the DirectX one fails to initialize (DX not installed on the system) and only supports windowed mode.
- Added support for the FBGFX environmental variable; set it to the name of the driver you want to be tried first. If specified driver fails or cannot be found, the usual automatic driver selection path is used.
- Added new instrinsic SCREENINFO function, to get informations on current mode like size, depth, name of the driver being used, etc.
- Fixed bug in coordinates rounding for negative values; PUT(-1,0) was drawing at (0,0) due to this bug (thanks rel for pointing this out)
- Fixed bug for which SCREENPTR always returned the current visible page memory pointer, instead of the current work page pointer (thanks again to rel for the bug report)
- Fixed coordinates rounding bugs in DRAW, now drawn figures should look as they are supposed to. Also, DRAW now accepts (and skips) spaces and tabs inside the commands string (thanks to steven_basic for the report)
- Various fixes to the X11 driver: was not working if the X server was running in 24bpp mode; had memory leaks if the Xshm extension was not used; mouse and keyboard input were still working if window did not have focus; mouse cursor was not hidden in fullscreen mode.
- Some other small fixes I don't recall now...

Pay attention: since a new GDI driver was added, your programs will now have to be linked against gdi32.dll... The 0.11 fbc compiler doesn't know about this, so you have to manually tell it to link in that library:
Code:
fbc myprog.bas -l gdi32
This will not be needed in next FB release as the compiler will automatically link in gdi32 when gfxlib is used.
Nice work...I think DRAW still has some problems though. This draws a donkey in QB:

Code:
SCREEN 1
DRAW "S8"
DRAW "BM14,18"
DRAW "M+2,-4R8M+1,-1U1M+1,+1M+2,-1
DRAW "M-1,1M+1,3M-1,1M-1,-2M-1,2"
DRAW "D3L1U3M-1,1D2L1U2L3D2L1U2M-1,-1"
DRAW "D3L1U5M-2,3U1"

With your new (and old) gfxlib it looks like...well I don't know, but not a donkey. Not sure exactly where it's messing up.

(btw, that donkey should look familiar to you old timers Tongue)
It seeems as if the +- movements are confusing the DRAW function. If you remove the + from each number you get a completely different outcome even though a + and a non-negative should be the same...
Quote:I think DRAW still has some problems though
DRAW breaks when passed a null string.
Here goes a harder sample. The result is perfect in QB...
Code:
'===========================================================================
' Subject: ENGLISH SCRIPT FONTS               Date: Unknown Date (00:00:00)
'  Author: Unknown Author(s)                  Code: QB, QBasic, PDS    
'  Origin: ENGLISH,SCRIPT,FONTS             Packet: GRAPHICS.ABC
'===========================================================================
DIM a$(122)
     a$(32) = "BR8"
     a$(33) = "BR2G2RED8BD2D2HR2HBU2U3LU3R2D3U5FBU2BR2"
     a$(34) = "BRBUGDRND2RULBR3DRND2RULUBR3"
     a$(35) = "BR7G2D6LDU6L2GR3D3L3GR3ND2R4UNL2D3EU5NL3UL2NUR3UD"
     a$(35) = a$(35) + "5R2EL3U3R3EL3U2EBR5"
     a$(36) = "BR5DND15G4D4RNU4E3R3D6LNU6DLDL3HL2NDE2GR2DR2U10RF"
     a$(36) = a$(36) + "URUNL3EBUBR3"
     a$(37) = "BR4LG3DED2ED2EDE3LEL2EL2EBR6G2RDLD2HD3HD3HD3HD2UB"
     a$(37) = a$(37) + "R6REL3EL2ELE3DED2ED3EUBU7BR2"
     a$(38) = "BR6RF2NG3L2UL2G2RGDEDRND3G2NR3G3RGDERGDERGD2EURE3"
     a$(38) = a$(38) + "H2R2D2F5REUGLNH4UH4E2R2D2RENL5BU8BR3"
     a$(39) = "BRD4UHR2UL2BUBR5"
     a$(40) = "BR6G4REG3REG3R2UG2ND5RD7RU4D5RU3FDBU16BR3"
     a$(41) = "BD17E4LGE3LGE3LGUE2DHENU3LNU5HNU5UHU3GDBU2BR7"
     a$(42) = "BR3D3ND3NL3NR3NG2NH2NF2E2BUBR3"
     a$(43) = "BR5BD4D4ND4NL4LND5NU3DL4R8UL3R4BU8BR3"
     a$(44) = "BRBD13D3GE2UL2RBU14BR5"
     a$(45) = "BD9NR6ER6BU8BR3"
     a$(46) = "BD15R2GU2BU14BR5"
     a$(47) = "BD16E2LELE2DHE2DHE2DHE2DHE2DHE2BR3"
     a$(48) = "BR4G3D8UHU4E4NR2DNR3FNR3FR2GR2D4LU4D6G3UNE3L2H2ED"
     a$(48) = a$(48) + "RDRBU12BR8"
     a$(49) = "BD2E2ND13GR2UD13H2R4GE2BU11BR3"
     a$(50) = "BD4E4L2D3HUR2ER2DRND5FD3NG3LNG7LG5D3GUENR6FNR4FR2"
     a$(50) = a$(50) + "E2HREBU10BR3"
     a$(51) = "BR3G3NF2RE2RNG3DRF2DHD2HD4H2ED2R2D4ENU2G4H3LE2D2E"
     a$(51) = a$(51) + "D2ED2EBU13BR6"
     a$(52) = "BR6D14FU14LG6DR8FL8R6D3FDEBU13BR3"
     a$(53) = "BR9G3L4U2R5GL4D6E3RG2RERGR2FND3L3FRD3G3LHNR3HNR5H"
     a$(53) = a$(53) + "LR4H2GRBU10BR10"
     a$(54) = "BR5F2RGH2LF2DH2LG2D9HNU6UE5D2EUD3EUND5FD3G5U3LU3B"
     a$(54) = a$(54) + "U11BR9"
     a$(55) = "BD3E2R7GNL7G2RG2RG2ERG3ERG2ERG2D2FU3ED4E2LBU13BR6"
     a$(56) = "BDBR6L3G3R2DL2FRED3HR3HD2R3HD3HR3ND3GD3G2NH4L2UR2"
     a$(56) = a$(56) + "NH4L3ULULUE8L2DEUL2UBR6"
     a$(57) = "BUBR4G4D3FNU4EUD3RU2FE4ND5GD6G2NL5G2HRU2L2EBU7BR4"
     a$(57) = a$(57) + "R2UH2LF2LNH2LHU2BR7"
     a$(58) = "BD7R2GU2BD6D2HR2BU13BR4"
     a$(59) = "BD7R2HD2BD4D3GE2UL2BU13BR6"
     a$(61) = "BD6R6EL6BD3R6GNL6BU9BR5"
     a$(63) = "BR3G3ER4HLD2R3DL2FRG4DBD2D2HR2BU13BR6"
     a$(65) = "BD6U3NE2RE3NR3DR4G3L2DEUR3EG2DGDG2NH3NR7DNR7G2NR3"
     a$(65) = a$(65) + "DNR4DFBR3HR2E3D3FNE2U14GND9E2BR3"
     a$(66) = "BD3UEDRUR3EG3D4L2GDER2D5LG2NDE2REU9FED8EU8EDER3GR"
     a$(66) = a$(66) + "2D2HD2G2HUND9D2R3ND5FD4LG2L5GE3R3DL3BU13BR8"
     a$(67) = "BDBR4G3RG2ND4RD6FNU4RNU2ED2NR4UR6NE2NUL3U12G3D6EU"
     a$(67) = a$(67) + "6ER5GLU2LUBR6"
     a$(68) = "BDBR2NR7FR8GR2GRD2NL2D3NL2D3GNL6GL6GE3U10G3D7G2E3"
     a$(68) = a$(68) + "U2L3GE2R2U4E2R2D5RGD2RGDBU11BR7"
     a$(69) = "BR4G3ND8RG2D4RED4RNU2FNU2NR4ER5NE2NUL3U12G3D6EU6E"
     a$(69) = a$(69) + "NR7ER2D2R3G4R4UNL3BU5BR3"
     a$(70) = "BD6E2DR3UL2EU2D14L2GR2ERURUHU11R7NUL2UL3ED13GU8R3"
     a$(70) = a$(70) + "EL4U4BUBR8"
     a$(71) = "BD6D4FDU8E3D9G2U2D3NR7ERD2R4HU12L2ND8R5HD2R2GR2G4"
     a$(71) = a$(71) + "R4HLD2R2ND3LD3G2BU13BR6"
     a$(72) = "BD3UNR5ER5EG4D9GRENU9FRNU11EU11E2NRG2D4RE3D2END9R"
     a$(72) = a$(72) + "D7G2LEBU13BR5"
     a$(73) = "BD3URUR2D12L2GDR2UEU11EBR3G2D12L2DRE2U12EBR3"
     a$(74) = "BD5BRRUL2U2E2R3DL4R6DL3R5LG3D9GL3G2ER3DRUR3U2RU10"
     a$(74) = a$(74) + "ED9BL3DU9E2RERBUBR3"
     a$(75) = "BD3E2R3NEGL2FD8G2LGE5DU8BR2NE2D8G3R4HLD2FURE3D2FU"
     a$(75) = a$(75) + "2FRDH4LF2EH2E3LEL3GE2RBU3BR6"
     a$(76) = "BD2E2R4EG2NL4D11L2G2ERENU9RNE3R2F2RNE3HRNE2UE2LHB"
     a$(76) = a$(76) + "L3NU7FU7EBU3BR7"
     a$(77) = "BR6LG4D11LUREU5L2UR2U4ERD11NG2U5R6D5EG3H2R3GNU12H"
     a$(77) = a$(77) + "U6LNR5RU5LHR2DR6H2GRGND5R2DR2D12NEHU11E2BUBR3"
     a$(78) = "BD3E2D2R3H2D14L3NDER2EU10RED11NG2U4E3R4GDGDGDGDR4"
     a$(78) = a$(78) + "EG2L2U2RHEUEUEU3L3FRU2L3G3E4RL5E2RGR2BUBR7"
     a$(79) = "BR9L4G5ND6RD8R8LGL4U2LUE2NU8LU7ER6FL3HGD10UE3R3DG"
     a$(79) = a$(79) + "3REU5FUL3NG2RE2DHULBU3BR6"
     a$(80) = "BUBD3E3D2LR2HD2LR2ND14GND13DG3R2GRDFGLNG2DR2D4R3U"
     a$(80) = a$(80) + "3NU13R4GU2L3R5EL2E2DNU7HU2L2G3FRLHE3REUL3NGR"
     a$(80) = a$(80) + "2EU2GU2GL2E2NDBR8"
     a$(81) = "BR8L3G5ND6RD8R10GR2EGHL3GL4UHUF2R2NU13R2E4G2DEU9L"
     a$(81) = a$(81) + "3HR3D2LFNG3DERD4L3G3UBL3NU8EU8EBR11"
     a$(82) = "BD14E5U8EG2L2GE2RD10G2E3FG2R5G2HRU2LUENU8ENE4F4DN"
     a$(82) = a$(82) + "E3H2R3H3LNF3UE2U4L4E2D3FR2UL2U2BUBR8"
     a$(83) = "BR11G6H3UE2R3D2REL6GF3NR6L2HG2DED2ED2NR7ENR5RE2L2"
     a$(83) = a$(83) + "R8GR2ND3GD3G3UGU4RNDG5L3HU2R7DH2RL5R2UBU10BR13"
     a$(84) = "BD3E2DE2NR5DR9EG2L5D6G3NU3LU7NE3RG2D3F2E2NU5G2NR2"
     a$(84) = a$(84) + "DR8NE2NULGNL4U12BUBR7"
     a$(85) = "BD3E2R6EG2L6R4G4ND4RNED6FU3FD2FU2FR3NE4GNL2U13G2D"
     a$(85) = a$(85) + "6GU5EBR4E3D13E2L3DU11FRBU3BR4"
     a$(86) = "BD3UE2RG2RD10NLENU11D2F2NE6H2R3GUHRUNE3U3NE3U6H2B"
     a$(86) = a$(86) + "R7NG3D9ENL3U3NL3U3NL2UHBR4"
     a$(87) = "BD3E3D14H2RU9LE2RFD12GU3FRE2U10GE2D14HUF2DU3RD2NE"
     a$(87) = a$(87) + "4U13BR2UED11EU9HBR4"
     a$(88) = "BD3E3D4FU4LGR2D6L3ER3U4D6GDG2ND2L3NDERFRBR4R4EG3R"
     a$(88) = a$(88) + "EL2U2LND2LU5R3GL3D3R2UL2U5EUE2LED3FU3FDE"
     a$(88) = a$(88) + "BU2BR4"
     a$(89) = "R3GRD10NG3LG2D2ED2NR3ER4HR5DGBU3L2BU2RL4U10FRUD9U"
     a$(89) = a$(89) + "E3R3D2G2LEURU4L3NGR4DU3GU2GU2GUL2BR8"
     a$(90) = "BD3UE2D2LR8U2GNL7D2NG5LG3L3R8L2GLDR3L8R4G2RERG3UG"
     a$(90) = a$(90) + "D2GUR8GU2R2L7RER5EBU11BR3"
     a$(97) = "BD6NE3F2G2D2F2U3HD2RFUR3D2EL2NU9EU8NEL3F2DGNLEU3H"
     a$(97) = a$(97) + "BU3BR6"
     a$(98) = "RD12NLFNU13FU2FURENU7RU6L2U2G3U6EBR7"
     a$(99) = "BD6NE3RD5GR5EG2LGU3LRU6E2D2ED2EBU5BR3"
     a$(100) = "BFGDERGR2GR2G4ND4RD5FU3FD3E3NU6LNGU5NE2ULURBU5BR5"
     a$(101) = "BD7RNE3D4GRFNU6F2NE3UEL2ELU2E4L3FU2LBU5BR6"
     a$(102) = "BR3G2D12LR3GU9L2R4L2U4EDED2EBU2BR3"
     a$(103) = "BD17R5EL5E6D5L2EU2L2GLEL2NU5EU4E3D2ED5EU4EBU4BR3"
     a$(104) = "BDFD13E2NL3HU10NE2D6E4GDED9G3ERE2U9BU5BR3"
     a$(105) = "BD6ED9FE2LGU9RHBU2URBUBR4"
     a$(106) = "BD5ED2ED10GE2U8H2BU2URBUBR4"
     a$(107) = "BDFD12HR4G2U13NE2D6E3R2FL3FRG4ER2GR2D4EUL2U3BU10"
     a$(107) = a$(107) + "BR5"
     a$(108) = "BDFD11NL2DFELU13EBR3"
     a$(109) = "BD6UED10HF2ELU9FNRE2D10FU10FNRE2D10RNE2U9FBU6BR3"
     a$(110) = "BD5NE2RED9FE2LGU9FNE2RED2RU2D9FE2LGU8EBU4BR4"
     a$(111) = "BD7NE4ND4RD5F2UHUF2E2NU6LU4H2EDFU2BU4BR4"
     a$(112) = "BD5E2D13LR2NFU5NL2U7FE2D2ED9GH3R5DL3FE2U6BU5BR3"
     a$(113) = "BD6NE3ND6RNE2D7FU2FE2D5NGR2HU9FG2DU5L2EBU4BR6"
     a$(114) = "BD5NE2RED8HF3E2LGU2GU8FE2D2ED3EUBU5BR3"
     a$(115) = "BD13NE8R6GLU2NL3BR3ENU2LU3LD2HL3EL2NU2EU2E2DR4GN"
     a$(115) = a$(115) + "L2E2BU3BR3"
     a$(116) = "BD4NE3RD9HR2D2EDNE2HU10FRBU4BR4"
     a$(117) = "BD5NE2RED8FNU9FU3FDEF2E2L3FU10G2R3G2D5U8BU4BR6"
     a$(118) = "BR3G3RDEUD10NLF2NE4U2RL2ELU7BR4NHD7EU5BU5BR3"
     a$(119) = "BR2G2D2RU3D12HF2EUGU9FE2ND9FD8F2E2RGNHEU9NG3FND8"
     a$(119) = a$(119) + "BU4BR3"
     a$(120) = "BD6E3DGRD2RU2D5G4U3FRE2RD2RD2E3GLHUHUE4D2HLE2BU3BR3"
     a$(121) = "BD5NE2RED10GDFR3EUGBH3RNU10EDE4NU6LU5G2BU6BR6"
     a$(122) = "BD7UE3D2ED2EDG4R4HLD2R3DL2D2EL2DL2GDFR2EBU16BR5"
     SCREEN 18
    ' CLS
    
     DRAW "C 14S4 BM1,100"
     w$ = "Quick Basic 4.5 now offered in English Script!"
     GOSUB loop1
      
     DRAW "c 15;s4 bm1,10"
     w$ = "!#$%&'()*+,-./0123456789:;<=>?&"
     GOSUB loop1
    
     DRAW "c 11;s4 bm1,40;"
     w$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
     GOSUB loop1

     DRAW "C 14;S4 BM1,170;"
     w$ = "[\]^_'abcdefghijklmnopqrstuvwxyz"
     GOSUB loop1

     DRAW "c 11;s4 bm1,200;"
     w$ = "Wasn't I a nice guy to crop all those lines for you?"
     GOSUB loop1

     DRAW "c11;s4 bm1,220;"
     w$ = "You know those lines that go A$=A$+"
     GOSUB loop1
final:
DO: LOOP UNTIL LEN(INKEY$)
END

loop1:
FOR x = 1 TO LEN(w$)
y = ASC(MID$(w$, x, 1))
DRAW a$(y)
NEXT
RETURN
Quote:It seeems as if the +- movements are confusing the DRAW function. If you remove the + from each number you get a completely different outcome even though a + and a non-negative should be the same...

No, they should be treated differently. Without a + or -, the move is to an absolute position on the screen, with a + or -, the move is relative to the current position.
What does draw is very crooked.

The program crashes when trying to get the ASC() value for "<".

Edit:
Sorry.
I meant it crashes trying to print the "<" ASC() value 60.

Edit again:

Which is obviously what you said!
But I was wrong!

DRAW does'nt fail when a null string is passed to it...
It fails when trying to DRAW an unitialized element of an array of strings...
It's not the same, and perhaps it's not DRAW fault.

However in my sample, if you put something in the missing elements so draw does'nt break, you have more problems.
-The first "m" command is not correctly executed and the first string starts in the middle of the screen.
and
-As the first line goes out of screen, the next lines are not drawn, perhaps because of the problem with the m command.
I added:
Code:
for counter = 1 to 122
    a$(counter) = " "
  next counter

at the top to initialize all stings to at least a space.

I removed the ";" character from the strings and got a little better listing on the screen. Also I edited the "C 15" to be "C15" , etc. to group the command and the value for the command together.

I get a screen of information, I just have very up-and-down wavy lines of text.

like this:
[Image: drawtext.gif]
Number nine, lowercase o and uppercase R are horrible.
This is the result with QBasic
[Image: imagen1.txt]
Ok, fixed everything on the DRAW side Smile

- Now accepts any character, skipping it instead of bumping out
- Draws the script font posted here perfectly
- Draws the donkey posted here almost perfectly: some pixels are not at the same position due to the different line algorithm used (the M draw command uses the line routine of course), but overall the shape is ok

Will post a new gfxlib CVS snapshot as soon as possible.

EDIT: ok, new snapshot available, same old location:

http://www.ecplusplus.com/index.php?page...fxlib2.zip

Changes since yesterday snapshot:

- GDI driver now updates the screen correctly
- DRAW fixes
- Now marks lines for update only when working on the visible page (makes much more sense and should speed up working on an offscreen page)
Pages: 1 2