* * *

Author Topic: needs a little help..  (Read 2136 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 4417
Re: needs a little help..
« Reply #15 on: July 04, 2017, 09:57:48 am »
And, btw, it is possible to use sfml in Object Pascal by translating the C binding headers using h2paspp and h2pas and a little manual massaging.
There may be even already a Pascal header out there...[edit] Yes there is: https://github.com/DJMaster/csfml-fpc
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Handoko

  • Hero Member
  • *****
  • Posts: 1514
  • My goal: build my own game engine using Lazarus
Re: needs a little help..
« Reply #16 on: July 04, 2017, 09:58:35 am »
so I need TCanvas to make something like C++'s sfml can make ?

It depends on what the 'something' you meant is.

Quoted from Wiki:
Quote
Simple and Fast Multimedia Library (SFML) is a cross-platform software development library designed to provide a simple application programming interface (API) to various multimedia components in computers.

From the description above, we can know SFML is optimized for performance.

TCanvas is slow. If your application does not perform a lot of screen drawing, TCanvas is okay. But if you want to do graphics, games or multimedia, you should choose other libraries:

http://wiki.freepascal.org/Developing_with_Graphics
http://wiki.lazarus.freepascal.org/Graphics_libraries

I ever tried BGRABitmap, Allegro.pas, Castle Game Engine, all of them have good performance, should be enough to used for most cases. But if you want 'better' performance, you may try to use OpenGL to control the hardware directly:

http://wiki.freepascal.org/OpenGL
http://wiki.freepascal.org/OpenGL_Tutorial

Thaddy

  • Hero Member
  • *****
  • Posts: 4417
Re: needs a little help..
« Reply #17 on: July 04, 2017, 09:59:52 am »
See here Handoko, looks nice ;) https://github.com/DJMaster/csfml-fpc My edit crossed your last post again.
This may be an optimal solution for OP since he seems familiar with it.
« Last Edit: July 04, 2017, 10:02:21 am by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Handoko

  • Hero Member
  • *****
  • Posts: 1514
  • My goal: build my own game engine using Lazarus
Re: needs a little help..
« Reply #18 on: July 04, 2017, 10:05:44 am »
Great to know now SFML can be used on Free Pascal. It is very popular, I heard SFML a lot.

Someone please add it in to the wiki page.

Flaze07

  • New member
  • *
  • Posts: 24
Re: needs a little help..
« Reply #19 on: July 04, 2017, 11:14:41 am »
I see...thank you :) :D

(there's actually 2 sfml pascal bindings)

https://github.com/CWBudde/PasSFML

Edit : I tested these 2 pascal bindings several months ago... the codes were ugly, furthermore those are made for C++ and not pascal so ...I am just gonna try ZenGL (which is not updated anymore but it is the most popular ones I have heard)
« Last Edit: July 04, 2017, 11:56:45 am by Flaze07 »
pascal is good for learning programming language

Thaddy

  • Hero Member
  • *****
  • Posts: 4417
Re: needs a little help..
« Reply #20 on: July 04, 2017, 12:49:54 pm »
I see...thank you :) :D

(there's actually 2 sfml pascal bindings)

https://github.com/CWBudde/PasSFML
Christian Budde's version is based on the other one by Laurent Gomila. Christian usually writes extremely good code.
Quote
Edit : I tested these 2 pascal bindings several months ago... the codes were ugly, furthermore those are made for C++ and not pascal so ...I am just gonna try ZenGL (which is not updated anymore but it is the most popular ones I have heard)
The Pascal bindings are for Pascal use, not C++. Just the library is programmed and compiled in C++.
ZenGL is a mess (and not popular for that reason, not only because it isn'tmaintained) but there seems to be one (1) person that advocates its use.
That's something different from popular...

Try the BGRABitmap stuff and the TOpenGlControl. Those are popular! maintained! and very, very good!
« Last Edit: July 04, 2017, 01:00:43 pm by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Flaze07

  • New member
  • *
  • Posts: 24
Re: needs a little help..
« Reply #21 on: July 04, 2017, 01:09:34 pm »
ahh I see....thank you  :D
pascal is good for learning programming language

DJMaster

  • New member
  • *
  • Posts: 17
    • DJMaster on GitHub
Re: needs a little help..
« Reply #22 on: September 10, 2017, 10:01:09 am »
More info about csfml-fpc can be found within this thread:

https://forum.lazarus.freepascal.org/index.php/topic,33877.0.html

Take a look at the attached examples.

DJMaster

  • New member
  • *
  • Posts: 17
    • DJMaster on GitHub
Re: needs a little help..
« Reply #23 on: September 10, 2017, 10:25:08 am »
Great to know now SFML can be used on Free Pascal. It is very popular, I heard SFML a lot.

Someone please add it in to the wiki page.

Done! http://wiki.freepascal.org/Multimedia_Programming

Handoko

  • Hero Member
  • *****
  • Posts: 1514
  • My goal: build my own game engine using Lazarus
Re: needs a little help..
« Reply #24 on: September 10, 2017, 10:41:03 am »
You should also add some info here:
http://wiki.freepascal.org/Graphics_libraries

Linux is not supported yet. I'm a Linux user. :'(

DJMaster

  • New member
  • *
  • Posts: 17
    • DJMaster on GitHub
Re: needs a little help..
« Reply #25 on: September 11, 2017, 07:43:19 pm »
...
Linux is not supported yet. I'm a Linux user. :'(

I'm a Windows user but Linux support is not a big deal: https://github.com/DJMaster/csfml-fpc/commit/2e9832451965927ff4defa6780be61abab896850

I've just tested the attached Colorful.pas example and it worked like a charm under bot x86_64-linux and i386-linux  8-)

BTW: can you explain why under Linux I have to call SetExceptionMask to avoid the exception "EInvalidOp: Invalid floating point operation"?

Handoko

  • Hero Member
  • *****
  • Posts: 1514
  • My goal: build my own game engine using Lazarus
Re: needs a little help..
« Reply #26 on: September 12, 2017, 04:59:05 am »
Thanks DJMaster for making it Linux compilable.

I managed to compile Colorful.pas on my Linux64 GeForce 430, but I only got a blank window. I have libcfsml-dev 2.3 installed properly. I got no error but only 2 warnings when compiling.

DJMaster

  • New member
  • *
  • Posts: 17
    • DJMaster on GitHub
Re: needs a little help..
« Reply #27 on: September 12, 2017, 05:46:25 am »
SFML 2.4.2 and CSFML 2.4 are required. Make them from source and install in the right order. FPC 3.0.2 is recommended.

DJMaster

  • New member
  • *
  • Posts: 17
    • DJMaster on GitHub
Re: needs a little help..
« Reply #28 on: September 12, 2017, 07:07:48 am »
P.S.: shader loading has been modified in CSFML version 2.4 without backward compatibility: https://github.com/SFML/CSFML/issues/100

You can try the attached little Circle example, it should work out of the box.

Handoko

  • Hero Member
  • *****
  • Posts: 1514
  • My goal: build my own game engine using Lazarus
Re: needs a little help..
« Reply #29 on: September 12, 2017, 08:00:34 pm »
Hooray, it worked!  :D
Although just some circles, it gives me reasons to explore more.

Can you tell me how to deploy programs that use SFML, especially on Windows? What dll files are required to copy to the users?

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus