Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBaneTrapper

Posted 11 November 2012 - 02:42 PM

Hello.
I am hawing issues when drawing sf::Text onto screen. It is blurry in some cases!
The font on its own is not blurry at.
//TAKE NOTE When i changed the font, the problem remains

The problem occurs when text is some specified sizes.

Here are two examples: /* The "Height is" where the problem is if you don't see */
Image 1
http://postimage.org/image/6t4oj5a2h/
Image 2
http://postimage.org/image/98rr1cg51/

The code to images

//TAKE NOTE that the copy paste added errors where the '&' sign is, it added ";amp" for some reason
// The sequence the code goes is
objOptions.SetupOptions(*objApp);
objOptions.UpdateOptions(*objApp);
while( theGame == true )
{
	objOptions.DrawOptions(objWindow.Screen);
}

//The Actual code

void Options::SetupOptions(Application& objApp)
{
	recWindowInfo.setPosition(50.f, 50.f);
	recWindowInfo.setSize(sf::Vector2f(300.f, 150.f));
	recWindowInfo.setFillColor(sf::Color(150, 120, 200));
	recWindowInfo.setOutlineColor(sf::Color::Black);
	recWindowInfo.setOutlineThickness(1.f);
	txtWindowInfo.setCharacterSize(48);
	txtWindowInfo.setColor(sf::Color::White);
	txtWindowInfo.setFont(objApp.objFonts.Font1);
	txtWindowInfo.setString("Window size");
	objApp.objFunctions.CentertxtinrecTop(txtWindowInfo, recWindowInfo);
	txtWindowLine1.setCharacterSize(48);
	txtWindowLine1.setColor(sf::Color::White);
	txtWindowLine1.setFont(objApp.objFonts.Font1);
	txtWindowLine2.setCharacterSize(48);
	txtWindowLine2.setColor(sf::Color::White);
	txtWindowLine2.setFont(objApp.objFonts.Font1);
}
void Options::UpdateOptions(Application& objApp)
{
	std::stringstream conv;
	conv << "Width is " << objApp.objWindow.VidMod.width;
	txtWindowLine1.setString(conv.str());
	conv.clear();
	conv.str(std::string());
	conv << "Height " << objApp.objWindow.VidMod.height;
	txtWindowLine2.setString(conv.str());
	objApp.objFunctions.Centertxtinrec(txtWindowLine1, recWindowInfo);
	objApp.objFunctions.CentertxtinrecBot(txtWindowLine2, recWindowInfo);
}
void Options::DrawOptions(sf::RenderWindow& Screen)
{
	Screen.draw(recWindowInfo);
	Screen.draw(txtWindowInfo);
	Screen.draw(txtWindowLine1);
	Screen.draw(txtWindowLine2);
}
void Functions::Centertxtinrec(sf::Text& txt, sf::RectangleShape&; rec)
{
	txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left / 2,
					rec.getPosition().y + rec.getSize().y / 2 - txt.getGlobalBounds().height / 2 - txt.getGlobalBounds().top / 2);
}
//Top
void Functions::CentertxtinrecTop(sf::Text& txt, sf::RectangleShape& rec)
{
	txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
					rec.getPosition().y - txt.getGlobalBounds().top);
}
//Bot
void Functions::CentertxtinrecBot(sf::Text& txt, sf::RectangleShape& rec)
{
	txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
					rec.getPosition().y + rec.getSize().y - txt.getGlobalBounds().height - txt.getGlobalBounds().top);
}


EDIT : FIXED!
passing int parameters to setPosition(); function corrects the blur, using static_cast<in>

#6BaneTrapper

Posted 11 November 2012 - 12:09 PM

Hello.
I am hawing issues when drawing sf::Text onto screen. It is blurry in some cases!
The font on its own is not blurry at.
//TAKE NOTE When i changed the font, the problem remains

The problem occurs when text is some specified sizes.

Here are two examples: /* The "Height is" where the problem is if you don't see */
Image 1
http://postimage.org/image/6t4oj5a2h/
Image 2
http://postimage.org/image/98rr1cg51/

The code to images

//TAKE NOTE that the copy paste added errors where the '&amp;' sign is, it added ";amp" for some reason
// The sequence the code goes is
objOptions.SetupOptions(*objApp);
objOptions.UpdateOptions(*objApp);
while( theGame == true )
{
	objOptions.DrawOptions(objWindow.Screen);
}

//The Actual code

void Options::SetupOptions(Application& objApp)
{
	recWindowInfo.setPosition(50.f, 50.f);
	recWindowInfo.setSize(sf::Vector2f(300.f, 150.f));
	recWindowInfo.setFillColor(sf::Color(150, 120, 200));
	recWindowInfo.setOutlineColor(sf::Color::Black);
	recWindowInfo.setOutlineThickness(1.f);
	txtWindowInfo.setCharacterSize(48);
	txtWindowInfo.setColor(sf::Color::White);
	txtWindowInfo.setFont(objApp.objFonts.Font1);
	txtWindowInfo.setString("Window size");
	objApp.objFunctions.CentertxtinrecTop(txtWindowInfo, recWindowInfo);
	txtWindowLine1.setCharacterSize(48);
	txtWindowLine1.setColor(sf::Color::White);
	txtWindowLine1.setFont(objApp.objFonts.Font1);
	txtWindowLine2.setCharacterSize(48);
	txtWindowLine2.setColor(sf::Color::White);
	txtWindowLine2.setFont(objApp.objFonts.Font1);
}
void Options::UpdateOptions(Application& objApp)
{
	std::stringstream conv;
	conv << "Width is " << objApp.objWindow.VidMod.width;
	txtWindowLine1.setString(conv.str());
	conv.clear();
	conv.str(std::string());
	conv << "Height " << objApp.objWindow.VidMod.height;
	txtWindowLine2.setString(conv.str());
	objApp.objFunctions.Centertxtinrec(txtWindowLine1, recWindowInfo);
	objApp.objFunctions.CentertxtinrecBot(txtWindowLine2, recWindowInfo);
}
void Options::DrawOptions(sf::RenderWindow& Screen)
{
	Screen.draw(recWindowInfo);
	Screen.draw(txtWindowInfo);
	Screen.draw(txtWindowLine1);
	Screen.draw(txtWindowLine2);
}
void Functions::Centertxtinrec(sf::Text& txt, sf::RectangleShape&; rec)
{
	txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left / 2,
					rec.getPosition().y + rec.getSize().y / 2 - txt.getGlobalBounds().height / 2 - txt.getGlobalBounds().top / 2);
}
//Top
void Functions::CentertxtinrecTop(sf::Text& txt, sf::RectangleShape& rec)
{
	txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
					rec.getPosition().y - txt.getGlobalBounds().top);
}
//Bot
void Functions::CentertxtinrecBot(sf::Text& txt, sf::RectangleShape& rec)
{
	txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
					rec.getPosition().y + rec.getSize().y - txt.getGlobalBounds().height - txt.getGlobalBounds().top);
}

#5BaneTrapper

Posted 11 November 2012 - 12:02 PM

Hello.
I am hawing issues when drawing sf::Text onto screen. It is blurry in some cases!
The font on its own is not blurry at.

The problem occurs when text is some specified sizes.

Here are two examples: /* The "Height is" where the problem is if you don't see */
Image 1
http://postimage.org/image/6t4oj5a2h/
Image 2
http://postimage.org/image/98rr1cg51/

The code to images

//TAKE NOTE that the copy paste added errors where the '&amp;' sign is, it added ";amp" for some reason
// The sequence the code goes is
objOptions.SetupOptions(*objApp);
objOptions.UpdateOptions(*objApp);
while( theGame == true )
{
    objOptions.DrawOptions(objWindow.Screen);
}

//The Actual code

void Options::SetupOptions(Application& objApp)
{
    recWindowInfo.setPosition(50.f, 50.f);
    recWindowInfo.setSize(sf::Vector2f(300.f, 150.f));
    recWindowInfo.setFillColor(sf::Color(150, 120, 200));
    recWindowInfo.setOutlineColor(sf::Color::Black);
    recWindowInfo.setOutlineThickness(1.f);
    txtWindowInfo.setCharacterSize(48);
    txtWindowInfo.setColor(sf::Color::White);
    txtWindowInfo.setFont(objApp.objFonts.Font1);
    txtWindowInfo.setString("Window size");
    objApp.objFunctions.CentertxtinrecTop(txtWindowInfo, recWindowInfo);
    txtWindowLine1.setCharacterSize(48);
    txtWindowLine1.setColor(sf::Color::White);
    txtWindowLine1.setFont(objApp.objFonts.Font1);
    txtWindowLine2.setCharacterSize(48);
    txtWindowLine2.setColor(sf::Color::White);
    txtWindowLine2.setFont(objApp.objFonts.Font1);
}
void Options::UpdateOptions(Application& objApp)
{
    std::stringstream conv;
    conv << "Width is " << objApp.objWindow.VidMod.width;
    txtWindowLine1.setString(conv.str());
    conv.clear();
    conv.str(std::string());
    conv << "Height " << objApp.objWindow.VidMod.height;
    txtWindowLine2.setString(conv.str());
    objApp.objFunctions.Centertxtinrec(txtWindowLine1, recWindowInfo);
    objApp.objFunctions.CentertxtinrecBot(txtWindowLine2, recWindowInfo);
}
void Options::DrawOptions(sf::RenderWindow& Screen)
{
    Screen.draw(recWindowInfo);
    Screen.draw(txtWindowInfo);
    Screen.draw(txtWindowLine1);
    Screen.draw(txtWindowLine2);
}
void Functions::Centertxtinrec(sf::Text& txt, sf::RectangleShape&; rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left / 2,
				    rec.getPosition().y + rec.getSize().y / 2 - txt.getGlobalBounds().height / 2 - txt.getGlobalBounds().top / 2);
}
//Top
void Functions::CentertxtinrecTop(sf::Text& txt, sf::RectangleShape& rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
				    rec.getPosition().y - txt.getGlobalBounds().top);
}
//Bot
void Functions::CentertxtinrecBot(sf::Text& txt, sf::RectangleShape& rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
				    rec.getPosition().y + rec.getSize().y - txt.getGlobalBounds().height - txt.getGlobalBounds().top);
}

#4BaneTrapper

Posted 11 November 2012 - 12:00 PM

Hello.
I am hawing issues when drawing sf::Text onto screen. It is blurry in some cases!
The font on its own is not blurry at.

The problem occurs when text is some specified sizes.

Here are two examples: /* The "Height is" where the problem is if you don't see */
Image 1
http://postimage.org/image/6t4oj5a2h/
Image 2
http://postimage.org/image/98rr1cg51/

The code to images

//TAKE NOTE that the copy paste added errors where the '&' sign is, it added ";amp" for some reason
// The sequence the code goes is
objOptions.SetupOptions(*objApp);
objOptions.UpdateOptions(*objApp);
while( theGame == true )
{
    objOptions.DrawOptions(objWindow.Screen);
}

//The Actual code

void Options::SetupOptions(Application&amp;amp; objApp)
{
    recWindowInfo.setPosition(50.f, 50.f);
    recWindowInfo.setSize(sf::Vector2f(300.f, 150.f));
    recWindowInfo.setFillColor(sf::Color(150, 120, 200));
    recWindowInfo.setOutlineColor(sf::Color::Black);
    recWindowInfo.setOutlineThickness(1.f);
    txtWindowInfo.setCharacterSize(48);
    txtWindowInfo.setColor(sf::Color::White);
    txtWindowInfo.setFont(objApp.objFonts.Font1);
    txtWindowInfo.setString("Window size");
    objApp.objFunctions.CentertxtinrecTop(txtWindowInfo, recWindowInfo);
    txtWindowLine1.setCharacterSize(48);
    txtWindowLine1.setColor(sf::Color::White);
    txtWindowLine1.setFont(objApp.objFonts.Font1);
    txtWindowLine2.setCharacterSize(48);
    txtWindowLine2.setColor(sf::Color::White);
    txtWindowLine2.setFont(objApp.objFonts.Font1);
}
void Options::UpdateOptions(Application&amp;amp; objApp)
{
    std::stringstream conv;
    conv << "Width is " << objApp.objWindow.VidMod.width;
    txtWindowLine1.setString(conv.str());
    conv.clear();
    conv.str(std::string());
    conv << "Height " << objApp.objWindow.VidMod.height;
    txtWindowLine2.setString(conv.str());
    objApp.objFunctions.Centertxtinrec(txtWindowLine1, recWindowInfo);
    objApp.objFunctions.CentertxtinrecBot(txtWindowLine2, recWindowInfo);
}
void Options::DrawOptions(sf::RenderWindow&amp;amp; Screen)
{
    Screen.draw(recWindowInfo);
    Screen.draw(txtWindowInfo);
    Screen.draw(txtWindowLine1);
    Screen.draw(txtWindowLine2);
}
void Functions::Centertxtinrec(sf::Text&amp;amp; txt, sf::RectangleShape&amp;amp; rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left / 2,
				    rec.getPosition().y + rec.getSize().y / 2 - txt.getGlobalBounds().height / 2 - txt.getGlobalBounds().top / 2);
}
//Top
void Functions::CentertxtinrecTop(sf::Text&amp;amp; txt, sf::RectangleShape&amp;amp; rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
				    rec.getPosition().y - txt.getGlobalBounds().top);
}
//Bot
void Functions::CentertxtinrecBot(sf::Text&amp;amp; txt, sf::RectangleShape&amp;amp; rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
				    rec.getPosition().y + rec.getSize().y - txt.getGlobalBounds().height - txt.getGlobalBounds().top);
}

#3BaneTrapper

Posted 11 November 2012 - 11:59 AM

Hello.
I am hawing issues when drawing sf::Text onto screen. It is blurry in some cases!
The font on its own is not blurry at.

The problem occurs when text is some specified sizes.

Here are two examples: /* The "Height is" where the problem is if you don't see */
Image 1
http://postimage.org/image/6t4oj5a2h/
Image 2
http://postimage.org/image/98rr1cg51/

The code to images
// The sequence the code goes is
objOptions.SetupOptions(*objApp);
objOptions.UpdateOptions(*objApp);
while( theGame == true )
{
    objOptions.DrawOptions(objWindow.Screen);
}

//The Actual code

void Options::SetupOptions(Application&amp; objApp)
{
    recWindowInfo.setPosition(50.f, 50.f);
    recWindowInfo.setSize(sf::Vector2f(300.f, 150.f));
    recWindowInfo.setFillColor(sf::Color(150, 120, 200));
    recWindowInfo.setOutlineColor(sf::Color::Black);
    recWindowInfo.setOutlineThickness(1.f);
    txtWindowInfo.setCharacterSize(48);
    txtWindowInfo.setColor(sf::Color::White);
    txtWindowInfo.setFont(objApp.objFonts.Font1);
    txtWindowInfo.setString("Window size");
    objApp.objFunctions.CentertxtinrecTop(txtWindowInfo, recWindowInfo);
    txtWindowLine1.setCharacterSize(48);
    txtWindowLine1.setColor(sf::Color::White);
    txtWindowLine1.setFont(objApp.objFonts.Font1);
    txtWindowLine2.setCharacterSize(48);
    txtWindowLine2.setColor(sf::Color::White);
    txtWindowLine2.setFont(objApp.objFonts.Font1);
}
void Options::UpdateOptions(Application&amp; objApp)
{
    std::stringstream conv;
    conv << "Width is " << objApp.objWindow.VidMod.width;
    txtWindowLine1.setString(conv.str());
    conv.clear();
    conv.str(std::string());
    conv << "Height " << objApp.objWindow.VidMod.height;
    txtWindowLine2.setString(conv.str());
    objApp.objFunctions.Centertxtinrec(txtWindowLine1, recWindowInfo);
    objApp.objFunctions.CentertxtinrecBot(txtWindowLine2, recWindowInfo);
}
void Options::DrawOptions(sf::RenderWindow&amp; Screen)
{
    Screen.draw(recWindowInfo);
    Screen.draw(txtWindowInfo);
    Screen.draw(txtWindowLine1);
    Screen.draw(txtWindowLine2);
}
void Functions::Centertxtinrec(sf::Text&amp; txt, sf::RectangleShape&amp; rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left / 2,
				    rec.getPosition().y + rec.getSize().y / 2 - txt.getGlobalBounds().height / 2 - txt.getGlobalBounds().top / 2);
}
//Top
void Functions::CentertxtinrecTop(sf::Text&amp; txt, sf::RectangleShape&amp; rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
				    rec.getPosition().y - txt.getGlobalBounds().top);
}
//Bot
void Functions::CentertxtinrecBot(sf::Text&amp; txt, sf::RectangleShape&amp; rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
				    rec.getPosition().y + rec.getSize().y - txt.getGlobalBounds().height - txt.getGlobalBounds().top);
}

#2BaneTrapper

Posted 11 November 2012 - 11:59 AM

Hello.
I am hawing issues when drawing sf::Text onto screen. It is blurry in some cases!
The font on its own is not blurry at.

The problem occurs when text is some specified sizes.

Here are two examples: /* The "Height is" where the problem is if you don't see */
Image 1
http://postimage.org/image/6t4oj5a2h/
Image 2
http://postimage.org/image/98rr1cg51/

The code to images
// The sequence the code goes is
objOptions.SetupOptions(*objApp);
objOptions.UpdateOptions(*objApp);
while( theGame == true )
{
    objOptions.DrawOptions(objWindow.Screen);
}

//The Actual code

void Options::SetupOptions(Application&amp; objApp)
{
    recWindowInfo.setPosition(50.f, 50.f);
    recWindowInfo.setSize(sf::Vector2f(300.f, 150.f));
    recWindowInfo.setFillColor(sf::Color(150, 120, 200));
    recWindowInfo.setOutlineColor(sf::Color::Black);
    recWindowInfo.setOutlineThickness(1.f);
    txtWindowInfo.setCharacterSize(48);
    txtWindowInfo.setColor(sf::Color::White);
    txtWindowInfo.setFont(objApp.objFonts.Font1);
    txtWindowInfo.setString("Window size");
    objApp.objFunctions.CentertxtinrecTop(txtWindowInfo, recWindowInfo);
    txtWindowLine1.setCharacterSize(48);
    txtWindowLine1.setColor(sf::Color::White);
    txtWindowLine1.setFont(objApp.objFonts.Font1);
    txtWindowLine2.setCharacterSize(48);
    txtWindowLine2.setColor(sf::Color::White);
    txtWindowLine2.setFont(objApp.objFonts.Font1);
}
void Options::UpdateOptions(Application&amp; objApp)
{
    std::stringstream conv;
    conv << "Width is " << objApp.objWindow.VidMod.width;
    txtWindowLine1.setString(conv.str());
    conv.clear();
    conv.str(std::string());
    conv << "Height " << objApp.objWindow.VidMod.height;
    txtWindowLine2.setString(conv.str());
    objApp.objFunctions.Centertxtinrec(txtWindowLine1, recWindowInfo);
    objApp.objFunctions.CentertxtinrecBot(txtWindowLine2, recWindowInfo);
}
void Options::DrawOptions(sf::RenderWindow&amp; Screen)
{
    Screen.draw(recWindowInfo);
    Screen.draw(txtWindowInfo);
    Screen.draw(txtWindowLine1);
    Screen.draw(txtWindowLine2);
}
void Functions::Centertxtinrec(sf::Text&amp; txt, sf::RectangleShape&amp; rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left / 2,
				    rec.getPosition().y + rec.getSize().y / 2 - txt.getGlobalBounds().height / 2 - txt.getGlobalBounds().top / 2);
}
//Top
void Functions::CentertxtinrecTop(sf::Text&amp; txt, sf::RectangleShape&amp; rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
				    rec.getPosition().y - txt.getGlobalBounds().top);
}
//Bot
void Functions::CentertxtinrecBot(sf::Text&amp; txt, sf::RectangleShape&amp; rec)
{
    txt.setPosition(rec.getPosition().x + rec.getSize().x / 2 - txt.getGlobalBounds().width / 2 - txt.getGlobalBounds().left,
				    rec.getPosition().y + rec.getSize().y - txt.getGlobalBounds().height - txt.getGlobalBounds().top);
}

PARTNERS