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

Author Topic: Font crashes  (Read 2807 times)

0 Members and 1 Guest are viewing this topic.

andreaszdw

  • Newbie
  • *
  • Posts: 26
    • View Profile
Font crashes
« on: January 12, 2009, 11:58:10 am »
If I do this:

Code: [Select]

sf::Font font;

    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Ballspiel");


// Load font file on disk
if (!font.LoadFromFile("font/Videophreak.ttf"))
return EXIT_FAILURE;

sf::String buftext ("Hello!", font, 15);


my program crashes.

What's wrong? (the fontfile is in the correct place for loading)

andreaszdw

  • Newbie
  • *
  • Posts: 26
    • View Profile
Unicode was it
« Reply #1 on: January 12, 2009, 01:11:40 pm »
I found my error, it was unicode.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Font crashes
« Reply #2 on: January 12, 2009, 01:55:02 pm »
Can you give more details please? It may be helpful for other users :)
Laurent Gomila - SFML developer

Mikea

  • Newbie
  • *
  • Posts: 28
    • View Profile
Font crashes
« Reply #3 on: January 12, 2009, 06:26:28 pm »
yes please :D
Check out my sfml games here

andreaszdw

  • Newbie
  • *
  • Posts: 26
    • View Profile
Error was unicode
« Reply #4 on: January 13, 2009, 09:59:44 am »
I had to change this line:

Code: [Select]
sf::String buftext ("Hello!", font, 15);

to this:

Code: [Select]
sf::String buftext (L"Hello!", font, 15);


Than everything was alright.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Font crashes
« Reply #5 on: January 13, 2009, 10:29:22 am »
Well, both codes are supposed to work. Can you tell us which OS, compiler and version of SFML you're using? Are you able to use a debugger to get more details about the crash?
Laurent Gomila - SFML developer

andreaszdw

  • Newbie
  • *
  • Posts: 26
    • View Profile
Font crashes Info
« Reply #6 on: January 13, 2009, 12:48:47 pm »
I'd tried it on Windows XP, with the MingW-Compiler and SFML 1.4 (the official download)

Sorry up to now I didn't use a debbugger.

I will try this at home with my Linux System.

 

anything