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

Author Topic: SFML 2.0 problems?  (Read 4495 times)

0 Members and 1 Guest are viewing this topic.

Xeon06

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
SFML 2.0 problems?
« 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:
Code: [Select]

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.
Code: [Select]

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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML 2.0 problems?
« Reply #1 on: January 21, 2010, 07:29:56 am »
Quote
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?

Quote
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.
Laurent Gomila - SFML developer

Xeon06

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
SFML 2.0 problems?
« Reply #2 on: January 21, 2010, 11:58:43 pm »
Quote from: "TurtoiseSVN"
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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML 2.0 problems?
« Reply #3 on: January 22, 2010, 07:36:42 am »
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)?
Laurent Gomila - SFML developer

Xeon06

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
SFML 2.0 problems?
« Reply #4 on: January 22, 2010, 12:45:11 pm »
Of course! Now I feel really dumb, sorry :D. I'll get myself a C compiler tonight and report back.

Xeon06

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
SFML 2.0 problems?
« Reply #5 on: January 22, 2010, 11:00:17 pm »
I had some trouble compiling it, but Mr.X on IRC helped me out and now everything is working fine! Thanks a lot.

 

anything