Qbasicnews.com

Full Version: How to write a Graphics Library?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I was very curious, how would you go about writing a library in freeBASIC? Is it anything like C++? If anyone has any detailed methods of making a gaphics library perhaps something like allegro by all means, please share with the community. :-)

Thanks in advance
Here's my gfx primitives library I use with sdl.

http://cvs.sourceforge.net/viewcvs.py/wi...I/SDL_GFX/

You can get the idea...
The FB built-in gfxlib works very similarly to Allegro, it's the same concept underneath (and benchmarks show this as they perform very similarly). What is missing from gfxlib is support for sprite scaling, rotation, blending and such high-level things... And I think a gfx add-on offering these features written in FB itself, sitting on top of gfxlib, would rock.

That said, to really reply to your question, since FB sits on a modern OS like Windows (or Linux), it can't access the screen memory directly like you did in DOS. So when you write a gfx library you have to use an existing API provided by the OS itself: DirectX or GDI in the case of Windows. Or use an existing library like SDL - or gfxlib (which both are actually just wrappers to DirectX or GDI).