sf::Text sfStr(text, *pSFFont, pFont->realsize);
sfStr.move( pos.x, pos.y );
sfStr.setColor( m_Color );
m_Target.draw( sfStr );
So I think that it's Label class uses some kind of buffer to render the text into, as this code is totally fine with the same font just without GWEN.Pulled GWEN from its git repo two days ago.This one? https://github.com/garrynewman/GWEN
This one? https://github.com/garrynewman/GWEN (https://github.com/garrynewman/GWEN)Yes.
Gwen does clipping on some things it renders via few pure GL calls, maybe that's causing the issue.I think thats the issue. I don't want to use another font... :(
//constructor
: _guiRenderer(&renderTarget),
_guiSkin(&_guiRenderer)
{
_guiSkin.Init(/*guiskinpath*/);
_guiSkin.SetDefaultFont(/*fontpath*/, 24);
_guiSkin.GetDefaultFont()->bold = true;
_guiCanvas = std::move(std::unique_ptr<Gwen::Controls::Canvas>(new Gwen::Controls::Canvas(&_guiSkin)));
_guiCanvas->SetSize(/**/);
_guiCanvas->SetDrawBackground(true);
sf::Color tmp = _config.getAmbient();
_guiCanvas->SetBackgroundColor({tmp.r, tmp.g, tmp.b, tmp.a});
_button = std::move(std::unique_ptr<Gwen::Controls::Button>(new Gwen::Controls::Button(_guiCanvas.get())));
_button->SetText(/**/);
_button->SetBounds(/**/);
}
//rendering
{
canvas->RenderCanvas();
}
#include <SFML/Graphics.hpp>
#include <cmath>
#include "Gwen/Renderers/SFML2.h"
#include "Gwen/Input/SFML.h"
#include "Gwen/Skins/Simple.h"
#include "Gwen/Skins/TexturedBase.h"
#include "Gwen/Controls.h"
int main()
{
sf::RenderWindow App(sf::VideoMode(800, 600), "test");
Gwen::Renderer::SFML2 GwenRenderer(App);
Gwen::Skin::TexturedBase skin(&GwenRenderer);
skin.Init("DefaultSkin.png");
skin.SetDefaultFont(L"Raleway Thin.ttf", 24);
Gwen::Controls::Canvas* pCanvas = new Gwen::Controls::Canvas(&skin);
pCanvas->SetSize(App.getSize().x, App.getSize().y);
pCanvas->SetDrawBackground(true);
pCanvas->SetBackgroundColor(Gwen::Color(150, 170, 170, 255));
Gwen::Controls::Button* pButton = new Gwen::Controls::Button(&pCanvas);
pButton->SetText(L"yyggjjppqq");
pButton->SetBounds(400, 200, 200, 200);
Gwen::Input::SFML GwenInput;
GwenInput.Initialize(pCanvas);
while(App.isOpen())
{
sf::Event Event;
while(App.pollEvent(Event))
{
if((Event.type == sf::Event::Closed))
{
App.close();
break;
}
else if(Event.type == sf::Event::Resized)
{
pCanvas->SetSize(Event.size.width, Event.size.height);
}
GwenInput.ProcessMessage(Event);
}
App.clear();
pCanvas->RenderCanvas();
App.display();
}
return 0;
}
Much like the GWEN SFML2 example.Not to you obviously...How should I know, I'm a programmer, not a clairvoyant. :P
So GWEN does cut the rendering using getLocalBounds and SFML internally does not? Why does it work with my depreciated version without GWEN?GWEN uses GL_SCISSOR_TEST (https://www.opengl.org/sdk/docs/man2/xhtml/glScissor.xml) to limit rendering of stuff to the right areas (that for text it calculates wrong...), SFML never does anything like that.