[Framework] OpenGL Accelerated 2D Engine (with SFML)

Developed or developing a new product in PureBasic? Tell the world about it.
IndigoFuzz

[Framework] OpenGL Accelerated 2D Engine (with SFML)

Post by IndigoFuzz »

Hi all,

As part of another project which I'm engaged in, I've started wrapping SFML to provide a slightly more modern 2D graphics system into PureBasic (as well as introducing Squirrel scripting, but that is still partially done so not yet ready to be offered).

After a couple of long weekends of crunching, I'd like to offer an interface to SFML including the following features;
  • Open an SFML rendering screen on a PureBasic window or gadget.
  • Ability to open multiple screens (though must all be on the main thread because OpenGL)
  • Screen control functions
  • Loading fonts from memory or file (Supports: TrueType, Type 1, CFF, OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42.)
  • Creating text drawables with transformation (scale, rotate, etc), outline and fill and rendering to the screen.
  • Loading textures from memory or file (Supports: bmp, png, tga, jpg, gif, psd, hdr and pic -- Avoid jpeg as not all jpeg encoding like progressive is supported)
  • Creating sprites from textures, sprite transformation and tinted colouring.
  • Partially implemented event handling (Keyboard and Mouse support)
  • Ability to resize the SFML screen parent and have the screen view resize (not stretch) with it.
  • Colour functions (mfwRGBA, mfwRed, mfwGreen, mfwBlue, mfwAlpha) -- Use these as PureBasic's colour functions aren't compatible due to how colours are stored in 32bit integers.
Alongside the graphics library, I've included a few other components of the framework it's being developed into;
  • Logging component which allows you to define custom logger outputs (console, file, etc). Console logger is included with the sample
  • Interval functions module - Call a procedure every x milliseconds (Procedure must return true to repeat, or it'll only fire once)
  • 143 named colour preset constants
Included:
  • Windows x86, x64 DLL (mfwlib.dll) which houses all the components and handles the interfacing. SFML and subsequent components are compiled in Unicode for seamless integration with PureBasic
    (Linux will also be included in the distant future when the main project this is part of becomes more mature)
All in all so far there are 97 functions in the graphics library alone, and more will be added over time (such as additional event handling, views, shaders), and I will endeavour to share it with you.

Image

Current backlog:
  • Complete Events handling (Handling Joystick, unicode character input)
  • Begin wrapping and binding handling of SFML views.
  • Identify a suitable automated documentation tool to create a reference guide.
  • Discussion about it's open sourcing, and consideration of related project to see if separation can be formed to isolate this library fully into open source domain.
Distant backlog:
  • Investigate how much of the shader library can be implemented
  • Introduce particle system
  • Retrospective on Squirrel-Language requirement and introduce low-level module for wrapped methods, as well as higher-level module for usage.
Feel free to clone and check out the sample included. Sorry there's no documentation (yet) but automated documentation is on my backlog for it for the near future.

GitLab Project Group
https://gitlab.com/mfwlib

Samples Repo
https://gitlab.com/mfwlib/sample

Include Repo
https://gitlab.com/mfwlib/mfw

DLL Source Repo
https://gitlab.com/mfwlib/mfwlib-src


This is provided as-is under CoffeeWare so if you like it then please feel free to get me a coffee https://ko-fi.com/randodev - it'd be greatly appreciated.
Last edited by IndigoFuzz on Mon Aug 31, 2020 3:01 pm, edited 7 times in total.
AMpos
Enthusiast
Enthusiast
Posts: 128
Joined: Fri Jun 05, 2020 12:47 am

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by AMpos »

How do I know what commands are there?
IndigoFuzz

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by IndigoFuzz »

AMpos wrote:How do I know what commands are there?
For now you'll have to look at the file mfw/graphics.pbi in the Module declaration to get an overview of the commands available. They should be quite self-explanatory, but if you have any questions then please feel free to ask them, or better yet check out the SFML documentation which will provide a good insight.

Screen functions: https://www.sfml-dev.org/documentation/ ... Window.php
Text functions: https://www.sfml-dev.org/documentation/ ... _1Text.php
Texture functions: https://www.sfml-dev.org/documentation/ ... exture.php
Sprite functions: https://www.sfml-dev.org/documentation/ ... Sprite.php
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by mk-soft »

Looks good.
But the DLL are close codes. And I never use codes from third parties that are not open.
Besides that, maybe you could use them for macOS and Linux.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
IndigoFuzz

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by IndigoFuzz »

mk-soft wrote:Looks good.
But the DLL are close codes. And I never use codes from third parties that are not open.
Besides that, maybe you could use them for macOS and Linux.
The code in the DLL is purely just a lot of wrapping, prototypes and some glue code with external libraries statically linked in (I can assure you nothing malicious);

If you want to check the source out then it's here: https://gitlab.com/mfwlib/mfwlib-src - though please understand I can offer zero support in setting up all the third party dependencies and compilation haha.

As for support for Linux, or Mac (though Mac would be less likely for now), when more updates are done on the main project this is associated with, I'll split the code repo into two (one for the project, one for public release) as some of the code going into the framework (including shared library) will be exclusive to the project I'm working on, and offer pre-compiled versions for windows and linux. For now I'm just offering SFML stuff since I imagine it'll be very useful to some :)
Last edited by IndigoFuzz on Mon Aug 31, 2020 3:14 pm, edited 2 times in total.
User avatar
leonhardt
Enthusiast
Enthusiast
Posts: 220
Joined: Wed Dec 23, 2009 3:26 pm

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by leonhardt »

Great engine! but I agree with mk-soft, libraries without source would not be good choices, there were so many engines out there but soon be dead as the author disappeared. So make it open source would be great :D
poor English...

PureBasic & Delphi & VBA
User avatar
leonhardt
Enthusiast
Enthusiast
Posts: 220
Joined: Wed Dec 23, 2009 3:26 pm

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by leonhardt »

IndigoFuzz wrote:
mk-soft wrote:Looks good.
But the DLL are close codes. And I never use codes from third parties that are not open.
Besides that, maybe you could use them for macOS and Linux.
The code in the DLL is purely just a lot of wrapping, prototypes and some glue code with external libraries statically linked in (I can assure you nothing malicious);

If you want to check the source out then it's here: https://www.indigofuzz.com/stuff/mfwlib_0.1_src.zip - though please understand I can offer zero support in setting up all the third party dependencies and compilation haha.

As for support for Linux, or Mac (though Mac would be less likely for now), when more updates are done on the main project this is associated with, I'll split the code repo into two (one for the project, one for public release) as some of the code going into the framework (including shared library) will be exclusive to the project I'm working on, and offer pre-compiled versions for windows and linux. For now I'm just offering SFML stuff since I imagine it'll be very useful to some :)
the source file seems not working for me, can you post another link, etc. Onedrive or Dropbox?
poor English...

PureBasic & Delphi & VBA
IndigoFuzz

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by IndigoFuzz »

leonhardt wrote:
IndigoFuzz wrote:
mk-soft wrote:Looks good.
But the DLL are close codes. And I never use codes from third parties that are not open.
Besides that, maybe you could use them for macOS and Linux.
The code in the DLL is purely just a lot of wrapping, prototypes and some glue code with external libraries statically linked in (I can assure you nothing malicious);

If you want to check the source out then it's here: https://www.indigofuzz.com/stuff/mfwlib_0.1_src.zip - though please understand I can offer zero support in setting up all the third party dependencies and compilation haha.

As for support for Linux, or Mac (though Mac would be less likely for now), when more updates are done on the main project this is associated with, I'll split the code repo into two (one for the project, one for public release) as some of the code going into the framework (including shared library) will be exclusive to the project I'm working on, and offer pre-compiled versions for windows and linux. For now I'm just offering SFML stuff since I imagine it'll be very useful to some :)
the source file seems not working for me, can you post another link, etc. Onedrive or Dropbox?
My apologies - link updated
IndigoFuzz

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by IndigoFuzz »

leonhardt wrote:Great engine! but I agree with mk-soft, libraries without source would not be good choices, there were so many engines out there but soon be dead as the author disappeared. So make it open source would be great :D
It's not going anywhere anytime soon, I can assure you of that - and like I said when things have matured a bit with the project this was initially designed for I'll break it up so that the wrapper becomes its own separate entity, hosted on gitlab for people to play with :)
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: OpenGL Accelerated 2D Engine (mit SFML)

Post by Saki »

Without disclosing the source code, they are riding a dead horse here.

I think, nobody wants to use it because it has no future.

Best Regards Saki
地球上の平和
IndigoFuzz

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by IndigoFuzz »

Saki wrote:Without disclosing the source code, they are riding a dead horse here.

I think, nobody wants to use it because it has no future.

Best Regards Saki
If you do look, the source code is provided above. Look, folks, if you want to use it then feel free. If not? That's absolutely fine too haha

Read through the thread and you'll see the intention to opensource once things are more mature with it rather than non-constructive response. And people wonder why this community doesn't attract more contributors and active members
marc_256
Enthusiast
Enthusiast
Posts: 742
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by marc_256 »

Hi IndigoFuzz,

As I had have a lot of troubles with 2D graphics in PB.
I did some small stuff with SFML in C++ to see and test.

And I must say, I loved SFML ...
and I love also PB, and if I see that these two are combined ...
I just love it.

I'm not a good C++ programmer, so I returned to PB
and I will use your stuff, but then it must be bug free.

It is already fine to see the first things.

thanks,
marc
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
IndigoFuzz

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by IndigoFuzz »

marc_256 wrote:Hi IndigoFuzz,

As I had have a lot of troubles with 2D graphics in PB.
I did some small stuff with SFML in C++ to see and test.

And I must say, I loved SFML ...
and I love also PB, and if I see that these two are combined ...
I just love it.

I'm not a good C++ programmer, so I returned to PB
and I will use your stuff, but then it must be bug free.

It is already fine to see the first things.

thanks,
marc
Hey Marc,

Good to hear :) There should be no bugs at all with this, at least on the bridge between PB and SFML, so long as pointers don't accidentally get modified, and correct structures are used when required then it should be quite robust.

Either this evening, or tomorrow I'll be completing the events bindings to just tick the box in those being complete and throughout the next week will work on managing views just to add a bit of enhancement. When that's done I'll update the links, and it will be the simple case of overwrite the existing mfw directory and the DLLs (which are included in the mfw/bin/msw/ directory)

Hopefully the next update will be by Friday, or Sunday at the latest.

I've added a backlog to the original post just to indicate progress to a next release, as well as a distant backlog to show planned features.
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by Mijikai »

PB getting access to a capable gfx library is nice to see.
Good luck :)
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: OpenGL Accelerated 2D Engine (with SFML)

Post by BarryG »

IndigoFuzz wrote:the source code is provided above
They probably missed that. A lot of us are wary of using libs without source because we've been bitten before when the lib owners suddenly disappeared and left our apps in limbo. So don't get too hard on us; we're still licking our wounds from those experiences.
Post Reply