SFML community forums
Help => General => Topic started by: Tigre Pablito on November 05, 2017, 02:10:06 am
-
Hello!
I'm having problems with Text class, I'm trying to use a wrapper to handle writting on the screen easier, and my app frequently ends up with a "Access violation exception: Attempting to read or write from the protected memory. Often this says that there is another memory damaged".
I think remember having read something about this issue a time ago, like that the problem is in the Font.
I'm creating the Font from a Byte[] array (my assets are packed into a file).
I don't know if writting this
Text text = new Text(string, new Font( byte[] array ));
or making the Font as an attribute of the class
Can anyone please help me or tell me where is the answer?
Thanks
-
Is this C#?
-
Yes, it is. And SFML.Net 2.2
-
Are you sure that you use the correct CSFML 2.2 binaries?
-
I have just overwritten them to ensure ...
And the issue persists ...
Now I made a static class for writting text on the screen, and on debugging I saw the GelLocalBounds().Height of the text that didn't appear was 0, not so the Width ... cos I'm aligning to the center some text
So some text appears and other doesn't
-
I don't know what to do ... it seems the problem is on the font ... I see with the debugger that some internal attributes of it are null and 0 ... some texts are drawn and others are not ... it seems this has no sense ... I don't think it is a bug, because it would have been found much before, I suppose
I tried both
text = new Text ( string, new Font ( byte[] array) );
and
text.Font = MyStaticClass.font;
and it's the same dislike
I can't understand why some texts are drawn and others are not, and always the same ones
-
Hey, Laurent, I was wrong. The issue is solved
I found out that, the same as with the Music class, if you load a Font from a byte[] array, that buffer has to remain in memory because SFML doesn't load the entire Font (or Music) into memory. (If loaded from a disk file it's less probable that the file disappears)
-
Yes, this is explained in the documentation by the way.
-
Yep, I knew that but about the Music class (cos I had run into the same issue), but I didn't read about Text or Font classes ... fortunately my poor brain made me associate the issues