[fpc-pascal] OT: fpc SDL HowTo (Was: Maybe a new fpc book :)

Tiziano De Togni tizzziano at tiscali.it
Tue Jan 8 08:54:58 CET 2008


Marco Ciampa ha scritto:
> On Sat, Jan 05, 2008 at 11:11:02AM +0100, Florian Klaempfl wrote:
>> Marco Ciampa schrieb:
>>> I work in a high school in Italy.
>>> ....
>>> console & 
>>> graph unit (BGI drivers under windows and Linux (X _not_ VGAlib) )
>> If one writes a book, _please_ use SDL for graphics and skip the legacy
>> graph unit :)
> Can someone please point me a simple BGI to SDL howto or some very simple
> Fpc SDL tutorials? 
> 
Hi, Marco,

I think that there is not (yet) a good answer to your question.

You can start from here: http://wiki.freepascal.org/FPC_and_SDL

Then you can find documentation about SDL and Free Pascal if you get and
install the latest JEDI-SDL v1.0:  http://sf.net/projects/jedi-sdl/
(\documentation\html\Using SDL under Free Pascal.htm).

For the graph side of your question, there is a project by Evgeniy
Ivanov to port the graph unit on SDL:
http://sourceforge.net/projects/sdlgraph
but it's still in a pre-alfa state.

I am actually working on another perspective.
SDL doesn't have functions to draw pixels, lines, rectangles, arcs,
ovals and text on the screen, and the FPC graph sources are the better
documentation I found about (there is also SGE, a nice SDL Graphics
Extension library in C but there are not headers translated for
pascal).

So I made first a little project including the basic Jedi-sdl units
(sdl.pas and sdl.inc) in order to work with the Lazarus IDE, then I made
a unit with equivalent graph procedures to draw on a SDL surface
(SDL_GetPixel, SDL_DirectputPixel, SDL_Line, SDL_Rectangle,
SDL_DrawPoly, SDL_FillPoly, SDL_Ellipse, SDL_OutTextXY, etc.).

This demo/test application (some sort of the classic bgidemo app)
compiles and works on Windows and Linux (Ubuntu), if you are interested
about this work I'll soon make it available on my home page. Keep in
mind that it's still work in progress...

It's not (yet) a tutorial, but, as Florian suggested, a practical
example about using SDL for graphics with Free Pascal.

tiziano










More information about the fpc-pascal mailing list