Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glScissors cropping text when Theme values are changed #2

Open
SwiTool opened this issue Mar 5, 2021 · 0 comments
Open

glScissors cropping text when Theme values are changed #2

SwiTool opened this issue Mar 5, 2021 · 0 comments

Comments

@SwiTool
Copy link

SwiTool commented Mar 5, 2021

I am on OSX and I created a view of 3840x2160, in a window of 1920x1080.

All the values in my view must be huge so they appear on smaller screens.

Here are the values I entered in Theme.cpp :

size_t    Theme::textSize = 54;
int       Theme::borderSize      = 10.f;
int       Theme::minWidgetWidth  = 800;
float     Theme::PADDING          = 10.f;
float     Theme::MARGIN           = 30.f;

Visually, it looks nice :
image

The code looks like this :

    gui::Menu menu(*win);
    gui::HBoxLayout* hbox = menu.addHBoxLayout();
    gui::FormLayout* form = hbox->addFormLayout();
    gui::TextBox *tb = new gui::TextBox(500);
    tb->setText("SwiTool");
    form->addRow("Pseudo", tb);

The problem is that I must comment the glScissors part, or I can't see what's in the textbox :

// in TextBox.cpp
    glScissor(pos.x + Theme::borderSize, target.getSize().y - (pos.y + getSize().y), getSize().x, getSize().y);

image

Then I added a debug RectangleShape to see where it actually crops. Here is the code for the rectangle :

    sf::RectangleShape rect(sf::Vector2f(getSize().x, getSize().y));
    rect.setPosition(sf::Vector2f(pos.x + Theme::borderSize, target.getSize().y - (pos.y + getSize().y)));
    rect.setFillColor(sf::Color::Transparent);
    rect.setOutlineThickness(5);
    rect.setOutlineColor(sf::Color::Red);
    target.draw(rect);

And this is the result :

image

I tried to play with the scissors value, but can't get it to work properly...
Any thoughts ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant