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

Author Topic: Text not rendering correctly  (Read 2941 times)

0 Members and 1 Guest are viewing this topic.

Averon01

  • Newbie
  • *
  • Posts: 3
    • View Profile
Text not rendering correctly
« on: April 07, 2012, 05:27:28 pm »
Hello
I've encountered a problem when displaying text.  When ever I draw text I get these blocks that look to be able the size of the character that should be present there. These blocks are the same colour as I've set the text. Any help would be great. Oh i'm using the latest revision of SFML.Net from GitHub.

This is my code:
Code: [Select]
text = new Text();
text.DisplayedString = "This produces blocks which look to be the same size of the letter";
text.Color = Color.Red;
text.Position = new Vector2f(0,0);
Graphics.Draw(text);

Cheers

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Text not rendering correctly
« Reply #1 on: April 07, 2012, 05:39:14 pm »
Can you please show a complete and minimal code that reproduces the problem?
Laurent Gomila - SFML developer

Averon01

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Text not rendering correctly
« Reply #2 on: April 07, 2012, 05:56:39 pm »
Here you go

Code: [Select]
using SFML.Graphics;
using SFML.Window;

namespace TextProblem
{
public class EntryPoint
{
public static void Main()
{
Program prog = new Program();
}
}

public class Program
{
RenderWindow Graphics;
bool running;
Text text;

public Program()
{
Graphics = new RenderWindow(new VideoMode(800,600),"Text problem");
text = new Text();
text.DisplayedString = "Text";
text.Position = new Vector2f(0,0);
text.CharacterSize = 30;
Loop();
}

public void Loop()
{
running = true;

while(running)
{
Graphics.DispatchEvents();
Graphics.Clear();
Graphics.Draw(text);
Graphics.Display();
}
}
}
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Text not rendering correctly
« Reply #3 on: April 07, 2012, 06:06:53 pm »
It works for me.

Which revision of SFML 2 are you using?

Which OS? Which graphics card?
Laurent Gomila - SFML developer

Averon01

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Text not rendering correctly
« Reply #4 on: April 07, 2012, 06:09:28 pm »
Just got it working myself, I hadn't used the newest csfml library which was provided. My bad.

Thanks for the fast response though!

 

anything