SFML community forums
Bindings - other languages => DotNet => Topic started by: Xeon06 on January 21, 2010, 04:13:22 am
-
Hey all,
Recently started messing around with 2.0. I understand this is still a WIP, but I still thought I'd point out a few problems I'm having. First of all, I seem to be unable to draw any kind of shape or text whatsoever. This code, which works in 1.5:
using System;
using SFML.Window;
using SFML.Graphics;
namespace Project2
{
class Program
{
static void Main()
{
RenderWindow app = new RenderWindow(new VideoMode(500, 500, 32), "Project2");
app.Closed += new EventHandler(OnClosed);
while (app.IsOpened())
{
app.DispatchEvents();
app.Clear();
app.Draw(Shape.Rectangle(new Vector2(0, 0), new Vector2(250, 250), Color.White));
app.Display();
}
}
static void OnClosed(object sender, EventArgs e)
{
((Window)sender).Close();
}
}
}
Doesn't work in 2.0 (that's copied and pasted). There was probably a change of some sort, but I can't get any Shape or Text to draw.
Second of all, whenever I draw a Text object, the application will crash on closing.
using System;
using SFML.Window;
using SFML.Graphics;
namespace Project2
{
class Program
{
static void Main()
{
RenderWindow app = new RenderWindow(new VideoMode(500, 500, 32), "Project2");
app.Closed += new EventHandler(OnClosed);
Text t = new Text("afafee");
while (app.IsOpened())
{
app.DispatchEvents();
app.Clear();
app.Draw(Shape.Rectangle(new Vector2(0, 0), new Vector2(250, 250), Color.White));
app.Draw(t);
app.Display();
}
}
static void OnClosed(object sender, EventArgs e)
{
((Window)sender).Close();
}
}
}
I think this is somehow related to SFML's RenderWindow.Close method because if I close directly the underlying system console window or exit the app by using "return" in Main, everything closes correctly. Maybe related to some cleanup done on closing?
-
Doesn't work in 2.0 (that's copied and pasted). There was probably a change of some sort, but I can't get any Shape or Text to draw.
Your code works for me, with both shapes and text. What error do you get? Which revision of SFML 2 do you use?
Second of all, whenever I draw a Text object, the application will crash on closing
This is a known "bug", which normally doesn't happen when you execute the application outside the IDE.
-
Completed: At revision: 1369
That's weird. I'm not getting any errors, just a blank screen from the color I cleared it. Here is the project, can you run the binary and see the rectangle?
http://dl.dropbox.com/u/3310651/Project2.rar
-
I got the same error, and simply replacing the CSFML DLLs with mine solved the problem. Are you sure that you recompiled them properly (after compiling SFML in static release)?
-
Of course! Now I feel really dumb, sorry :D. I'll get myself a C compiler tonight and report back.
-
I had some trouble compiling it, but Mr.X on IRC helped me out and now everything is working fine! Thanks a lot.