Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problems with SFML.NET (Version 2.0)  (Read 3409 times)

0 Members and 1 Guest are viewing this topic.

luiscubal

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Problems with SFML.NET (Version 2.0)
« on: August 17, 2011, 04:06:17 am »
EDIT: Somehow, I managed to screw up and post this on the wrong category. Could somebody move this?

I've been using SFML.NET (based on SFML 2) for a bit and, although I eventually got the Windows version to mostly work, I'm encountering some issues on Linux:

1. On Linux, The RenderWindow title gets weird for characters like é and ç. Perhaps an encoding-related issue? If the window title is composed entirely of "common" characters, then it looks ok.
2. On Linux, when the program draws text on the screen, there seems to be garbage at the end of the string(usually one square character, although different sequences appear ocasionally).
Code: [Select]

            using (var fps = new Text("some fps counter", FontManager.Font16px, 16))

            {

                fps.Position = new Vector2f(0, 580);
 //Window size (800, 600)
                fps.Color = Color.Black;

                target.Draw(fps);
 //where target is a RenderWindow
            }

3. On both Windows AND Linux, using the string constructor in Font(rather than the Stream one) causes a NullReferenceException on SFML.Graphics.Font.Destroy when the font is disposed. This seems to be due to a null Stream being disposed. A simple workaround for this is to simply use:
Code: [Select]

new Font(new FileStream(filename, FileMode.Open));


Aside from that, SFML 2 looks generally solid, although it took me quite some time to get the *.dll.config files to work on Linux.
Also, although my system is x64 and as such sfml/csfml were probably compiled as x64. However, the sfmlnet-*.dll were compiled as x86(because they were compiled on Windows x86 and I was too lazy to compile them again on Linux x64). Not sure if that makes a difference, since aside from fonts SFML seems to be working great(haven't tested audio, though)
The font I'm using on both OS is arial.ttf taken from Windows 7.

Looking forward to information on these potential bugs, especially the second one(since it's the one I haven't found a workaround for). Aside from that, thank you for designing a great library like SFML. Looking forward for the official SFML 2 release.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Problems with SFML.NET (Version 2.0)
« Reply #1 on: August 17, 2011, 08:07:10 am »
Quote
1. On Linux, The RenderWindow title gets weird for characters like é and ç. Perhaps an encoding-related issue? If the window title is composed entirely of "common" characters, then it looks ok.

Yes, in fact titles only support ASCII characters for now. Unicode is not supported everywhere the .Net string class is used in SFML.

Quote
2. On Linux, when the program draws text on the screen, there seems to be garbage at the end of the string

I have no idea about this one, I need to investigate more.

Quote
3. On both Windows AND Linux, using the string constructor in Font(rather than the Stream one) causes a NullReferenceException on SFML.Graphics.Font.Destroy when the font is disposed

Should be fixed now.

Thanks for your feedback :)
Laurent Gomila - SFML developer

luiscubal

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Problems with SFML.NET (Version 2.0)
« Reply #2 on: August 17, 2011, 05:11:56 pm »
For the garbage after the text, I discovered that if I append "\0" at the end of the string(normally not needed in C#), the problem goes away.

Code: [Select]

var fps = new Text("some fps counter" + "\0", FontManager.Font16px, 16); //works

omeg

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • http://omeg.pl/
Problems with SFML.NET (Version 2.0)
« Reply #3 on: August 22, 2011, 02:27:52 pm »
I've managed to run my gwen.net sample under linux and I'm getting the same problem with garbage at the end of strings (my code is unchanged, only sfml recompiled for Linux and using Tao for Mono):

 

anything