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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - PooBear

Pages: [1]
1
General / Re: Text displays solid [FIXED]
« on: March 06, 2013, 07:11:40 pm »
You do realise how common it is to be told "search the forums" though right? Very frustrating  :) I'd looked through about 20 threads on text and font problems that are not related to my issue.

"Drawing a rectangle breaks sf::Text"

Aha, that's the key piece of missing information, googling that  took me straight to the right thread.

My laptop has ATI hardware like many of those posting with the same problem, I can't update the drivers as it's locked to the manufacturer who seems to hardly ever bother updating. However, switching to a desktop machine that also has an ATI gpu (but has updated drivers) and the problem is gone. So it does seem driver related.

Thanks for your help  :)


2
General / Re: Text displays solid
« on: March 06, 2013, 05:23:56 pm »
Why is there always someone who jumps in with "try searching the forums"  ::)
<sigh>
I already have, obviously, or I wouldn't be posting  :)

Anyway...

Turns out it's something to do with SFML 2.0, if you just get the pong example and try printing text while the bats and ball are visible you get exactly the same problem. Maybe it's already fixed, my version says "LaurentGomila-SFML-527bb28".

Downloaded SFML 1.6 and it works fine.

3
General / Text displays solid [FIXED]
« on: March 06, 2013, 01:08:20 pm »
I'm a newbie so forgive what must be a stupid mistake. When I display text it renders as a solid rectangle of colour for each glyph. The size looks about right for each character. I based my first project on the pong example, so I've tried the same ttf font and arial.

Anybody see anything wrong with this code->
I've removed a bit of it for brevity.

sf::Font *pFont(nullptr);

int main()
{
   const int gameWidth = 800;
   const int gameHeight = 600;

   // Create the window of the application
   pWindow = new sf::RenderWindow(sf::VideoMode(gameWidth, gameHeight, 32), "Mouse and cheese");
   pWindow->setVerticalSyncEnabled(true);

   // Load the text font
   pFont=new sf::Font;
   if (!pFont->loadFromFile("resources/arial.ttf"))
      return EXIT_FAILURE;

   // Initialize the pause message
   sf::Text titleMessage;
   titleMessage.setFont(*pFont);
   titleMessage.setCharacterSize(40);
   titleMessage.setPosition(170.f, 150.f);
   titleMessage.setColor(sf::Color::White);
   titleMessage.setString("Mouse and Apples");

   while (pWindow->isOpen())
   {
      // Handle events
      sf::Event event;
      while (pWindow->pollEvent(event))
      {
         // Window closed or escape key pressed: exit
         if (event.type == sf::Event::Closed)
         {
            pWindow->close();
            break;
         }

      }


      // Clear the window
      pWindow->clear(sf::Color(50, 200, 50));

      pWindow->draw(titleMessage);

      // Display things on screen
      pWindow->display();
   }
   delete pFont;
   delete pWindow;
   return EXIT_SUCCESS;

}


Pages: [1]