
About GFXLIB
Click here to go to the GFXLIB demos page.
Initialising GFXLIB, loading a graphic (bitmap), and displaying it is as simple as this:
|
MODE 8 INSTALL @lib$ + "GFXLIB2" PROCInitGFXLIB ball% = FNLoadBMP( @dir$ + "graphics\ball", 0 ) SYS GFXLIB_Plot%, dispVars{}, ball%, 64, 64, 320, 256 PROCdisplay |
Download
|
Current version of GFXLIB: 2.02
Note: Version 2.02 completely replaces earlier versions.
Download link: Click here (right-click then "Save As ...") Download size: 4.25 MB Quick Start Guide (PDF): Click here
|
Below is a simple program which uses GFXLIB to draw 40 rebounding 'balls'. If you have the full version of
BBC BASIC for Windows installed on your computer, then you can copy & paste this program
into the BB4W IDE and run it (so long as you have GFXLIB 2.02 or later installed).
A link to a compiled executable of this program is given after the program listing. This can be run on
practically any PC without the need to have BBC BASIC for Windows installed.
|
REM Disable the Escape key
REM Set up a simple error handler
REM Make 2 MB of RAM available for this program
REM Prevent the program window being resized
REM Set up display mode 8 (640x512 pixels)
REM Install and initialise GFXLIB
REM Install the external GFXLIB module 'PlotShadow'
REM Load the ball bitmap (64x64 BMP file)
REM We'll have 40 balls bouncing around...
REM Set up a structure to hold the position and velocity
REM Define the initial positions and velocities of the balls
REM Switch off the automatic window refresh
REM Here's our main loop...
REM Clear the background (fill it with orange)
REM Draw the ball shadows, then the actual balls,
SYS GFXLIB_PlotShadow%, dispVars{}, ballBmp, 64, 64, \
SYS GFXLIB_Plot%, dispVars{}, ballBmp, 64, 64, \
ball{(I)}.x += ball{(I)}.dx
IF ball{(I)}.x < 0 OR ball{(I)}.x > 640-64 THEN
IF ball{(I)}.y < 0 OR ball{(I)}.y > 512-64 THEN
NEXT I
REM Render to the program window
UNTIL FALSE
DEF PROCerror |
Here is a screenshot of the above program in action:

You can download a compiled standalone executable of the program (40balls.exe) by clicking on the link below
(the download file size is only 68 KB!). The program should run directly from the ZIP folder, if not, then
extract the EXE file first to a suitable folder of your choice.
BBC BASIC for Windows is not required in order to run the compiled executable.
Download link: http://www.bb4wgames.com/gfxlib/40balls.zip