This is quite odd, we are both getting the same problem. Yet when I try to produce the error with minimal code it doesn't show up. Compiler error maybe? It might have to do with the way I'm drawing text: I'm creating my sf::Text inside a loop (which is called through multiple functions).
Here's the minimal code:
#include <string>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow Window(sf::VideoMode(800, 600), "SFML");
sf::Event Event;
while(Window.IsOpened()) {
while(Window.GetEvent(Event)) {
if(Event.Type == sf::Event::Closed) {
Window.Close();
break;
}
}
Window.Clear();
sf::Shape rTest = sf::Shape::Rectangle(10, 235, 32, 32, sf::Color(255, 255, 255, 255));
sf::Text tTest = sf::Text("My First Button", sf::Font::GetDefaultFont(), 10);
tTest.SetColor(sf::Color(172, 172, 172, 255));
tTest.SetPosition(sf::Vector2f(10, 235));
Window.Draw(rTest);
Window.Draw(tTest);
Window.Display();
}
return EXIT_SUCCESS;
}
Here is what I'm doing to draw text and debug, etc.
void SFMLRenderer::DrawRectangle(Rect& rect) {
sf::Shape sfRect = sf::Shape::Rectangle(rect.Left, rect.Top, rect.Width, rect.Height, m_Color);
m_pTarget->Draw(sfRect);
}
void SFMLRenderer::DrawText(std::string& text, Point& position) {
Gum::Base::Size size = MeasureText(text);
sf::Text sfText = sf::Text(text, sf::Font::GetDefaultFont(), 10);
sfText.SetPosition(sf::Vector2f((int)position.x, (int)position.y));
DrawRectangle(Gum::Base::Rect(position.x, position.y, size.w, size.h));
m_pTarget->Draw(sfText);
}
Edit I've added this in my DrawText:
if(sfText.GetPosition() != sf::Vector2f((int)position.x, (int)position.y)) {
printf("!=\n");
}
Nothing in the console. This is really weird.