SFML community forums

Bindings - other languages => DotNet => Topic started by: dabbertorres on October 03, 2016, 10:58:56 pm

Title: SFML.NET 2.4 Update
Post by: dabbertorres on October 03, 2016, 10:58:56 pm
Branch: https://github.com/dabbertorres/SFML.NET/tree/2.4

I made a few architecture/style changes that I wanted to make sure were discussed and accepted/not-accepted before submitting a PR.

The major things:
namespace SFML
{
    namespace Graphics
    {
        ....
vs
namespace SFML.Graphics
{
    ....

Comments, questions, concerns?
Title: Re: SFML.NET 2.4 Update
Post by: Laurent on October 04, 2016, 06:07:33 pm
Hi

Thanks a lot for your help :)

First, I think it would be cleaner if 2.4 update and style changes were in two different PRs. Even more if those style changes are unrelated to each other.

Quote
When updating and debugging to make sure all is well, I realized that only the release CSFML dlls were being used, making debugging a little more annoying. I fixed this by adding a (internal) CSFML class to each module (ie: SFML.Graphics.CSFML, etc) that contains an internal const string with the name of the CSFML dll to be used. It's value is determined by an #if !DEBUG switch. This allows the CSFML debug dlls to be loaded in debug mode, and vice versa in release mode.
This means that we have to ship the Debug version of CSFML with SFML.Net, right?
And the convention is to name constants in CamelCase, not in UPPER_CASE (so it should be DllName). "Dll" might also be too Windows-specific, since on other OSes we'll load dylib or so files.

Quote
I moved the Context class to the Window module, to match up with SFML and CSFML (it was in Graphics). Side-Effects: had to be made public, which I felt was okay, due to Context being publically available in both SFML and CSFML. More uniform APIs, essentially.
Fine. I have no idea why it was different in first place.

Quote
Null-Conditional operator usage. This feature is tied to the C# 6.0 compiler, not to a .NET version. So it works when compiling SFML.NET for .NET 3.5 (with VS 2015, at least). I wasn't sure if the targeted support version was for Visual Studio (C# compiler) or .NET, hence my question on this.
No need to make the internal code depend on new language features when it changes nothing for the end user, and only restricts the environments where SFML.Net can be compiled.

Quote
Style-wise, SFML.NET used two different namespace styles:
Yes, the second one looks better :)
Title: Re: SFML.NET 2.4 Update
Post by: dabbertorres on October 05, 2016, 06:45:33 pm
Happy to help!

Quote
First, I think it would be cleaner if 2.4 update and style changes were in two different PRs. Even more if those style changes are unrelated to each other.
Agreed. I'll split the changes.

Quote
This means that we have to ship the Debug version of CSFML with SFML.Net, right?
Yes, debug versions of CSFML would need to be shipped as well. I expect this isn't necessarily desired, so another thought I had was to have another macro definition, to enable/disable this behavior, so only those who want it (library developers, etc) would need to worry about debug versions of CSFML.
ie:
#if !(DEBUG && SFML_NET_USE_NATIVE_DEBUG)
Best of both worlds, I think.
Now that I'm thinking about it again, do you think this should be a separate PR as well?

Quote
And the convention is to name constants in CamelCase, not in UPPER_CASE (so it should be DllName). "Dll" might also be too Windows-specific, since on other OSes we'll load dylib or so files.
Will fix. True, I guess I was in .NET mode. :) How about NativeLib or NativeLibName?

Quote
No need to make the internal code depend on new language features when it changes nothing for the end user, and only restricts the environments where SFML.Net can be compiled.
Will revert.
Title: Re: SFML.NET 2.4 Update
Post by: Laurent on October 05, 2016, 08:13:33 pm
Quote
another thought I had was to have another macro definition, to enable/disable this behavior
So people who want the debug CSFML libraries must recompile SFML.Net with this macro defined?
My turn to suggest something: would it be possible (and not too weird) to use the debug DLLs only if they exist, based on a runtime check, and fallback to release DLLs if they are not there?

Quote
How about NativeLib or NativeLibName?
NativeLib looks good.
Title: Re: SFML.NET 2.4 Update
Post by: dabbertorres on October 05, 2016, 11:09:13 pm
Correct. It's at least nicer than manually changing all the library names. :) Plus, SFML.NET compiles relatively quickly.
But I do understand why it may not be desirable.

Yes, I believe it is possible (quick Google search confirms this). It'd boil down to using the OS-specific library loading functions (LoadLibrary/GetProcAddress and dlopen/dlsym). It's not complicated by any means, but I'm not certain if it is worth it or not.

(Side note: OSX and Linux both using dlopen/dlsym simplifies things)
Title: Re: SFML.NET 2.4 Update
Post by: dabbertorres on October 13, 2016, 11:45:53 pm
Bump @Laurent.

Any more thoughts? Should I leave this out for now, and just make PRs for the 2.4 update and the style changes?

edit:
2.4 Update (https://github.com/SFML/SFML.Net/pull/135)
I'll wait to make a PR for the style changes once the 2.4 update is merged, since it is based on my 2.4 branch.
Title: Re: SFML.NET 2.4 Update
Post by: kazyamof on February 03, 2017, 06:15:05 pm
So, will be available the 2.4 version on the main SFML webpage?
I only see the 2.2 version.

@Laurent
Title: Re: SFML.NET 2.4 Update
Post by: kazyamof on March 30, 2017, 05:35:59 am
UP!
Title: Re: SFML.NET 2.4 Update
Post by: Laurent on March 30, 2017, 06:29:29 am
The current master is supposed to be 2.4, but we lack people to test it and build a release. Feel free to help :)
Title: Re: SFML.NET 2.4 Update
Post by: kazyamof on March 30, 2017, 07:07:37 am
What about the extlibs folder? Should be updated too? And how?
Title: Re: SFML.NET 2.4 Update
Post by: Laurent on March 30, 2017, 08:35:22 am
The extlibs should be updated too, of course. CSFML DLLs must be updated to 2.4, openal32.dll must be the same as in SFML 2.4, and libsndfile.dll is no longer used.
Title: Re: SFML.NET 2.4 Update
Post by: DarkDino on May 11, 2017, 07:29:52 am
Please publish the 2.4 update for .NET ;o;
Title: Re: SFML.NET 2.4 Update
Post by: [R]Viper on June 19, 2017, 10:38:46 pm
Is there a way I can help with the 2.4 release?
Title: Re: SFML.NET 2.4 Update
Post by: dabbertorres on June 20, 2017, 04:33:21 am
Testing! Try it out, use it, and respond with any feedback you have!
Title: Re: SFML.NET 2.4 Update
Post by: eXpl0it3r on June 20, 2017, 10:59:12 am
If you can provide binaries, dabbertorres, I think it would be about time to just put them out there and if issues arise one can always fix them. ;)
Title: Re: SFML.NET 2.4 Update
Post by: Gleade on June 21, 2017, 12:31:57 am
Testing! Try it out, use it, and respond with any feedback you have!

Hi, I lurk these forums frequently & I don't have much to contribute in terms of feedback. However; I have been using SFML 2.4 .NET in one of my current projects & haven't had any issues with it yet. Thanks.
Title: Re: SFML.NET 2.4 Update
Post by: dabbertorres on June 21, 2017, 05:29:50 am
Gleade,
Appreciate the feedback you do have!

If you can provide binaries, dabbertorres, I think it would be about time to just put them out there and if issues arise one can always fix them. ;)
Yeah, I can do that, can I assume creating the same exact package as the last release will do? (with updated binaries of course)
Title: Re: SFML.NET 2.4 Update
Post by: eXpl0it3r on June 21, 2017, 11:38:57 am
I think that would be enough.

Laurent: can you tag the version at one point?
Title: Re: SFML.NET 2.4 Update
Post by: mkalex777 on July 25, 2017, 03:48:16 pm
No need to make the internal code depend on new language features when it changes nothing for the end user, and only restricts the environments where SFML.Net can be compiled.

Totally agree, this is terrible when the code consists of such kind features and cannot be compiled with popular compillers.
Title: Re: SFML.NET 2.4 Update
Post by: s.baus on October 30, 2017, 11:24:09 am
Hello,

thanks for the effort porting it to 2.4. May I ask, when the release will be published on the download pages?

Thanks
Sven
Title: Re: SFML.NET 2.4 Update
Post by: Janush on December 01, 2017, 02:13:12 pm
Please guys teach noob how to generate this extlibs dlls. I really want to use this library. Cmake creates main lib files but I can't figure out how to get extlibs :(
Title: Re: SFML.NET 2.4 Update
Post by: Laurent on December 01, 2017, 02:51:31 pm
They are in the SFML (C++) repository/packages, you don't have to generate them.
Title: Re: SFML.NET 2.4 Update
Post by: Janush on December 01, 2017, 03:26:33 pm
They are in the SFML (C++) repository/packages, you don't have to generate them.
So what am I supposed to do? I came to the point that I download https://github.com/dabbertorres/SFML.Net/tree/2.4 (https://github.com/dabbertorres/SFML.Net/tree/2.4) and open SFML.Net/build/vc2010/SFML.net.sln in visual studio. Then build the project and I get dll's but then what? If i just add them as reference to new project it just't won't work, I get communicate that "Application is in break mode".
If I create dll's with Cmake from c++ library I get the same result.
I just don't know what to do anymore :(
My understanding of this subject is really limited and I can't do much about it now because it's really hard for me to find some useful informations in the Internet especially since English is my second language and whole programming world is so huge and overwhelming :(
Title: Re: SFML.NET 2.4 Update
Post by: Gleade on December 04, 2017, 11:34:44 pm
You should have 2 sets of DLL's in the same directory; the .NET DLL's and the CSFML DLL's.
Title: Re: SFML.NET 2.4 Update
Post by: Janush on December 06, 2017, 03:39:10 pm
You should have 2 sets of DLL's in the same directory; the .NET DLL's and the CSFML DLL's.
Yeah I should but I don't  :). I have no idea how to get those extlibs, I went probably through all .rar files on https://www.sfml-dev.org I even tried to build csfml with cmake but it's not going to work. Nothing looks like extlibs in 2.2 C# binding. Now I feel that I have no idea how all of it works and I wasted so much time that I give up. I will learn "pure" opengl because it's much easier that making sfml run. Thanks for trying to help anyway.
Title: Re: SFML.NET 2.4 Update
Post by: Gleade on December 20, 2017, 11:52:33 pm
Go to the SFML bindings page and download the C binaries and then put them in the location of your .NET DLLs.

Or, a much similar solution is to just use nuget and add SFML.NET 2.4 to your project, it comes with the CSFML binaries - so it should work off the bat with no extra steps.
Title: Re: SFML.NET 2.4 Update
Post by: Kuinox on April 08, 2018, 08:07:17 pm
Hi here ! 
I noticed that SFML.NET doesn't respect the .NET naming convention (https://msdn.microsoft.com/en-us/library/8bc1fexb(v=vs.71).aspx (https://msdn.microsoft.com/en-us/library/8bc1fexb(v=vs.71).aspx)) on the interface. 
Example: 
Drawable should be IDrawable. 
Realy not a hard fix, but, why SFML.NET is not following this naming convention ? 
If there is no problem i can do the pull request. 
This can be a cool fix for the 2.4. 
Also, for the vectors, why SFML.NET is not using generics ?