SFML community forums
Bindings - other languages => DotNet => Topic started by: bepawuca on December 04, 2010, 11:08:20 pm
-
Anything I write with SFML.NET 1.6 crashes on exit ('vshost.exe has stopped working' on Windows 7 and 'memory could not be read' on XP) if I create an instance of String2D at some point in the program, even in the sample included with the documentation. This problem also occurs when I do not draw the String2D to the screen, but only create it. I am using VS2005, and have added the csml-***.dll files under extlibs to bin\Debug and bin\Release, and added references to the .NET assemblies lib\sfml-***.dll.
Any ideas what might be going on? And, if not, are there any alternatives to String2D I could use?
-
It's a known bug. It shouldn't crash if you never use the default font.
-
I get the same crash even if I don't use the default font.
-
How do you create your String2Ds?
-
Here's the full code, taken from the documentation sample:
using System;
using SFML.Audio;
using SFML.Window;
using SFML.Graphics;
namespace Example
{
class Program
{
static void OnClose(object sender, EventArgs e)
{
// Close the window when OnClose event is received
RenderWindow window = (RenderWindow)sender;
window.Close();
}
static void Main(string[] args)
{
// Create the main window
RenderWindow app = new RenderWindow(new VideoMode(800, 600), "SFML window");
app.Closed += new EventHandler(OnClose);
// Create a graphical string to display
Font arial = new Font("arial.ttf");
String2D text = new String2D("Hello SFML.Net", arial);
// Start the game loop
while (app.IsOpened())
{
// Process events
app.DispatchEvents();
// Clear screen
app.Clear();;
// Draw the string
app.Draw(text);
// Update the window
app.Display();
}
}
}
}
Naturally, I've put arial.ttf in the right place for it to work.
-
Ok, seems like it's not the same bug. I don't think there's a workaround for this one, except switching to SFML 2.
-
Can I use SFML 2 with .NET 2.0 and VS2005?
-
Should be ok, yes.
-
I just tried it out and it works fine. Thanks for the help!