PDA

View Full Version : How to use SFML with Free Pascal?



jemby
19-03-2012, 07:56 PM
Hi, I'm pretty new to programminig so I'm not too sure how I would achieve this. I'd like to use SFML, which is a modern alternative to SDL 1.2 ( http://www.sfml-dev.org/ ) with Free Pascal as my main programing language. SFML is written in C++ and has a C binding.

Would I have to make a Pascal binding for SFML? Could I do the front end in C++ and the backend in Pascal?

I really don't know how to get started with this. :P

Cybermonkey
19-03-2012, 08:39 PM
That's not a trivial task although I would like to see a Free Pascal binding for SFML. For a first start I would recommend the document "How to use C code in Free Pascal projects" which can be found here: ftp://ftp.freepascal.org/fpc/docs-pdf/CinFreePascal.pdf
This could be interesting, too: http://wiki.freepascal.org/Common_problems_when_converting_C_header_files

paul_nicholls
19-03-2012, 09:27 PM
These links could be useful too:
Usinc C Objects in Delphi
http://rvelthuis.de/articles/articles-cobjs.html

Using C++ Object in Delphi
http://rvelthuis.de/articles/articles-cppobjs.html

cheers,
Paul

Stoney
19-03-2012, 09:49 PM
A long time ago I started some bindings with SFML 1.5. I never got very far, I just did some basic window and system modules. If you want to start with some new bindings, you should use the C bindings. It's much easier to work with and doesn't involve for you to write some C/C++ code.
But I don't think it's a good idea to start make some bindings right now as the release of SFML 2.0 is just a matter of days/weeks/months.

WILL
20-03-2012, 12:59 AM
Well translating header files from C to Pascal is nothing new ans you can tell from the amount of documentation. Starting on a completely new translation will mean it will take some time before you can actually start to see it's use. This also means if you start such a project, you may be tied to it for a while. Consider that before you start such a project.

It would also help to gather some collaborators to help with the translation, depending on the complexity of the libraries you are supporting.

SFML is new to me so I'll have to check it out myself, though I still find SDL to be quite handy for learning the basics of game programming. What advantages over SDL does SFML bring to the table?

Cybermonkey
02-05-2012, 08:34 PM
Any news about the bindings? The SFML page reports:

SFML 2.0 RC is out

DJMaster
22-09-2016, 09:41 PM
Take a look at this fresh new binding for the Free Pascal Compiler:

https://github.com/DJMaster/csfml-fpc

Strongly tested under Windows. Other OSs will be availble soon.

http://www.pascalgamedevelopment.com/attachment.php?attachmentid=1426&stc=1

http://www.pascalgamedevelopment.com/attachment.php?attachmentid=1427&stc=1

http://www.pascalgamedevelopment.com/attachment.php?attachmentid=1428&stc=1

http://www.pascalgamedevelopment.com/attachment.php?attachmentid=1429&stc=1

http://www.pascalgamedevelopment.com/attachment.php?attachmentid=1430&stc=1

gcarreno
19-10-2016, 10:40 PM
DJMaster's seems to be the one that has been updated more recently.

There's also another binding here: https://github.com/CWBudde/PasSFML

One can keep up with bindings here: http://www.sfml-dev.org/download/bindings.php