BBC BASIC for Windows
« GFXLIB »

Welcome Guest. Please Login or Register.
Apr 6th, 2018, 12:17am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1 ... 6 7 8  Notify Send Topic Print
 veryhotthread  Author  Topic: GFXLIB  (Read 2314 times)
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: GFXLIB
« Reply #108 on: Jun 27th, 2010, 5:57pm »

on Jun 27th, 2010, 1:26pm, David Williams wrote:
Perhaps the global variables declared upon initialising GFXLIB will disappear altogether in subsequent versions.

Am I right in thinking that none of these 'global variables' are actually needed by the user's program, but are provided only as an 'optional extra' to save him some effort (for example the predefined bitmap bm32%)? I understood that all the 'essential' shared variables are stored in dispVars{} and therefore not actually 'global'.

Richard.
User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: GFXLIB
« Reply #109 on: Jun 27th, 2010, 7:00pm »

on Jun 27th, 2010, 5:57pm, Richard Russell wrote:
Am I right in thinking that none of these 'global variables' are actually needed by the user's program, but are provided only as an 'optional extra' to save him some effort (for example the predefined bitmap bm32%)? I understood that all the 'essential' shared variables are stored in dispVars{} and therefore not actually 'global'.


A number of basic 'core' routines are assembled in GFXLIB2.BBC, including Plot, BPlot, and Clr. The addresses of these 'workhorse' routines are stored in global variables (GFXLIB_Plot%, GFXLIB_BPlot%, GFXLIB_Clr%, etc.). Which is why a user of GFXLIB 2 can simply do this to get a bitmap plotted:

Code:
REM. Display a pre-defined 64x64 bitmap
MODE 8
INSTALL @lib$ + "GFXLIB2"
PROCInitGFXLIB( dispVars{}, 0 )
SYS GFXLIB_Plot%, dispVars{}, bm32%, 64, 64, 320, 256
PROCdisplay 


(Yes, PROCdisplay is defined in GFXLIB2.BBC).

A few other global variables are created in GFXLIB2.BBC as well, including those containing the address of some trigonometric and division tables required by some of the external GFXLIB modules.

For every external GFXLIB module that the user INSTALLs, another global variable is created. For example, the external module PlotBlend creates a new global called GFXLIB_PlotBlend%:

Code:
MODE 8
INSTALL @lib$ + "GFXLIB2" : PROCInitGFXLIB( dispVars{}, 0 )
INSTALL @lib$ + "GFXLIB_modules\PlotBlend.BBC" : PROCInitModule
SYS GFXLIB_PlotBlend%, dispVars{}, bm32%, 64, 64, 320, 256, 80
PROCdisplay
 



I was going to have the user initialise the module using something like (for example):

Code:
INSTALL @lib$ + "GFXLIB_modules\PlotBlend.BBC"
plotblend% = FNInitModule
 

Which would at least have the global created within the user's program, rather than in the module.

But I'd completely forgotten about implementing this idea until about er... 15 seconds ago.

Not to mention the considerable extra work that would be involved.


Regards,

David.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: GFXLIB
« Reply #110 on: Jun 27th, 2010, 9:51pm »

on Jun 27th, 2010, 7:00pm, David Williams wrote:
The addresses of these 'workhorse' routines are stored in global variables (GFXLIB_Plot%, GFXLIB_BPlot%, GFXLIB_Clr%, etc.)

OK. I suppose I wasn't counting the actual routine addresses as global variables, but I see what you mean.

Quote:
I was going to have the user initialise the module using something like (for example)...
plotblend% = FNInitModule

Yes, that seems a nice way to do it and decouples the library's name space from the user's name space.

Richard.
User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: GFXLIB
« Reply #111 on: Jul 2nd, 2010, 01:51am »

"Flying pink worm" demo (DirectX9 fullscreen version)

Nothing new here really, just a previously uploaded GFXLIB demo modified to employ Michael Hutton's GFXD3D9LIB for fullscreen DirectX9 display.

DirectX9 is therefore required. Users running the demo on older computers (more than 8 years old, let's say) should expect a low frame rate.

http://www.bezu.co.uk/filesdump/temp/progs/flyingpinkworm-dx9.zip

Press SPACE BAR during the demo to exit. Don't press Alt+F4 to exit.

The forthcoming release of GFXLIB (version 2.01) will, apart from some important modifications, contain a few additional programs demonstrating the use of GFXD3D9LIB.


David.
« Last Edit: Jan 18th, 2012, 5:01pm by David Williams » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: GFXLIB
« Reply #112 on: Jul 3rd, 2010, 9:06pm »

on Jul 2nd, 2010, 01:51am, David Williams wrote:
Don't press Alt+F4 to exit.

Why not? It's what I always do to exit a full-screen program (if there's no obvious alternative). Tony Tooth's full-screen programs specifically tell you to quit them that way.

If for some reason you really don't want Alt-F4 used, put an ON CLOSE RETURN in the program, but in that case I'd expect pressing Esc to work.

Richard.
User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: GFXLIB
« Reply #113 on: Jul 3rd, 2010, 11:30pm »

on Jul 3rd, 2010, 9:06pm, Richard Russell wrote:
Why not?


Circuitous answer: Why would you want to press Alt+F4 (two keystrokes) to exit the program when you can simply press Space Bar?

Alt+F4 is more fiddly and more energy consuming.

The other reason is that this particular version of the program might not exit cleanly if you press Alt+F4.



David.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: GFXLIB
« Reply #114 on: Jul 4th, 2010, 09:54am »

on Jul 3rd, 2010, 11:30pm, David Williams wrote:
Why would you want to press Alt+F4 (two keystrokes) to exit the program when you can simply press Space Bar?

  1. Because by that time I've forgotten that it said to press the Space Bar (if I ever noticed in the first place!).

  2. Because Alt+F4 is a standard way of quitting a program (there's a standard for a single-key exit too, but it's Esc not Space).

Quote:
The other reason is that this particular version of the program might not exit cleanly if you press Alt+F4

I'm surprised. Normally Windows does a good job of cleaning up after itself when quitting an executable (of course Alt+F4 might not work when running the program in the IDE, but I don't have the opportunity to do that!). But, as I said, in that case you should include ON CLOSE RETURN in your code, not rely on the user reading the instructions!

Richard.
« Last Edit: Jul 4th, 2010, 09:57am by admin » User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: GFXLIB
« Reply #115 on: Jul 4th, 2010, 9:44pm »

on Jul 4th, 2010, 09:54am, Richard Russell wrote:
But, as I said, in that case you should include ON CLOSE RETURN in your code, not rely on the user reading the instructions!


Thanks.

If only I'd known about the ON CLOSE RETURN trick when I was making Alien Eliminator. smiley

The updated version of the flying pink worm demo (which has replaced the old) now ignores Alt+F4 and has the user exiting the program either by pressing Escape or by clicking a mouse button.


David.
User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: GFXLIB
« Reply #116 on: Jul 8th, 2010, 07:45am »

I'll be releasing an updated version (2.01) of GFXLIB on Friday (9th July),
but in the meantime here's a 'mini-game' which will be included in the
GFXLIB package. Not much of a game, admittedly, however the
source code is meant to be instructive:

http://www.bezu.co.uk/filesdump/temp/progs/cowboyshootout.zip (283 KB)

(The ZIP package only contains the compiled EXE, not the source.)
« Last Edit: Jan 18th, 2012, 5:01pm by David Williams » User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: GFXLIB
« Reply #117 on: Jul 9th, 2010, 10:08pm »

GFXLIB version 2.01 has just been released:

http://www.bb4wgames.com/gfxlib/gfxlibpage.html


Happy game-making. grin



----------------------------------------------------
2.01 09-Jul-2010

- Most of GFXLIB routines have been modified to read
the dispVars.flags.paint& and dispVars.flags.flipY&
flags. A few routines remain, however, to be similarly
modified. This will be done in due course.

- Added new routine GetQuarticBezierCurvePoint, and
made some example programs for it.

- Made some example programs for GetQuadraticBezierCurvePoint.

- Added new routine PlotGetCumulativeAlphaBits and
ShapeGetCumulativeAlphaBits and wrote an example program
for each of them.

- PROCWait (as employed by PROCdisplay - you don't normally
call this subroutine directly yourself) now much more efficient.

- Added PROCFlipBmFont subroutine which vertically flips
all bitmap characters in a GFXLIB bitmap font definition
file.

- Re-introduced parameterless PROCInitGFXLIB call.
Calling simply PROCInitGFXLIB is equivalent to
PROCInitGFXLIB(dispVars{}, 0).

- Added new core routine: SetDispVars2

- Core routines now documented -
(see "Core GFXLIB routines.TXT").

- GFXLIB package now includes Michael Hutton's
GFXD3D9LIB.BBC (with some minor modifications by D.W.),
and wrote an example program for it.

- Modified some old GFXLIB demos to make use of GFXD3D9LIB
(see the DX9 subfolder in the GFXLIB_demos folder).

- Corrected or otherwise modified some of the GFXLIB
routine documentation. Still quite a bit of correcting and
modifying to do!

- Included a new mini-game "Cowboy Shootout" whose purpose,
apart from entertaining for a few seconds, is to demonstrate
the use of a number of GFXLIB routines.

- Several other minor changes here and there.
----------------------------------------------------
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: GFXLIB
« Reply #118 on: Jul 10th, 2010, 09:18am »

on Jul 8th, 2010, 07:45am, David Williams wrote:
the source code is meant to be instructive.... (The ZIP package only contains the compiled EXE, not the source.)

ROFL!

Richard.
« Last Edit: Jul 10th, 2010, 09:20am by admin » User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: GFXLIB
« Reply #119 on: Jul 10th, 2010, 09:34am »

on Jul 10th, 2010, 09:18am, Richard Russell wrote:
ROFL!


If you insist.

I should have stated that the source program (for "Cowboy Shootout") comes with the GFXLIB package, whereas the ZIP folder (cowboyshootout.zip) contains only the compiled executable.

The GFXLIB package contains an updated (i.e. slightly better) version of Cowboy Shootout.
User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: GFXLIB
« Reply #120 on: Jul 14th, 2010, 01:38am »

I've been working on a new bitmap rotation routine for GFXLIB.

Despite still partially being in BASIC(!), this one is significantly faster than "my old one",
and yet it's still very far from optimal. In fact, until I can get my Sutherland-Hodgman polygon clipper
working properly, this routine will remain very inefficient.

Here's a preview:

http://www.bezu.co.uk/filesdump/temp/progs/bitmaprotator.zip


Use the left and right mouse buttons to zoom in and out.


David.
« Last Edit: Jan 18th, 2012, 5:00pm by David Williams » User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: GFXLIB
« Reply #121 on: Jul 21st, 2010, 12:09am »

New routine (alpha-blend with master opacity control) as recently requested by a BB4W user who's developing a GFXLIB-based game.

Here's a quick demo of PlotAlphaBlend4:

http://www.bezu.co.uk/filesdump/temp/progs/plotalphablend4demo.zip

Notice the nice smooth sprite edges? Use the left/right arrow keys to decrease/increase the number of sprites.

This routine will be included in the next release (v2.02) of GFXLIB due out in a month or three.


David.
« Last Edit: Jan 18th, 2012, 5:00pm by David Williams » User IP Logged

David Williams
Developer

member is offline

Avatar

meh


PM

Gender: Male
Posts: 452
xx Re: GFXLIB
« Reply #122 on: Jan 18th, 2012, 5:23pm »

NOTE: Most of the web links (URLs) in this thread (prior to this post) are no longer valid.


~ ~ ~


I have modified an old GFXLIB example program to display a rotating 3D toroidal ring donut:

http://www.bb4wgames.com/gfxlibdemos/progs/exe/donut.zip


I was 'inspired' by this little DarkBASIC demo (YouTube video):

"Oldschool Demo - Shaded vector balls"
http://www.youtube.com/watch?v=XUGHoqM7myk

EDIT (21/01/2012): Here's my attempt so far (using above YouTube video as a reference).
It only runs at half the 'optimum' frame rate on my laptop (30 fps instead of 60 fps):

http://www.bb4wgames.com/gfxlibdemos/progs/exe/donut2.zip


Bear in mind that the DarkBASIC program will have been compiled to native x86 machine code, whereas donut2.exe is still actually interpreted BASIC.


Other GFXLIB demos:

http://www.bb4wgames.com/gfxlibdemos/gfxlib_demos_index.html


David.

« Last Edit: Jan 20th, 2012, 11:45pm by David Williams » User IP Logged

Pages: 1 ... 6 7 8  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls