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 - jlomaka

Pages: [1]
1
Graphics / Re: Centering text on a rectangle not working
« on: November 06, 2020, 11:08:59 am »
In my case help this slightly modified solution, i just change this (textBounds.height / 2) to this textBounds.height

Code: [Select]
sf::FloatRect rectBounds = inputFieldRect_.getGlobalBounds();
sf::FloatRect textBounds = inputFieldText_.getGlobalBounds();

inputFieldText_.setPosition(
  rectBounds.left + (rectBounds.width / 2) - (textBounds.width / 2),
  rectBounds.top + (rectBounds.height / 2) - textBounds.height
);

Pages: [1]