v0.7 panel background textures

  • 2 Replies
v0.7 panel background textures
« on: 05 September 2015, 00:40:36 »

I was trying to set the background texture for a panel.

I tried the line below, but there doesn't appear to be a setbackgroundtexture method. I don't see any panel renderer class? Is this coming in a later version? Any recommendations to get around this currently?

Code: (cpp) [Select]
void drawEngine::setupPanel(sf::Vector2i pos, sf::Vector2i size, sf::Color passed_backGroundColour, string passed_panelName, sf::Texture *passed_texture)

if (gui.get(passed_panelName) == NULL)
tgui::Panel::Ptr mainMenuPanel = theme->load(themeConfFile);
mainMenuPanel->setPosition(pos.x, pos.y);
mainMenuPanel->setSize(size.x, size.y);
if (passed_texture != NULL)
« Last Edit: 05 September 2015, 00:53:44 by starkhorn »



  • *****
  • 1612
    • View Profile
    • Texus's Blog
Re: v0.7 panel background textures
« Reply #1 on: 05 September 2015, 00:52:04 »
I removed the background image in panel because there were other ways to achieve the same thing.

If the background is a normal image then you can use a tgui::Picture:
Code: (cpp) [Select]
Since the Picture class can apparently also be created from a sf::Texture you can do this in your code too:
(I almost recommended a 10 line long code using tgui::Canvas before I realized that this could also be achieved with Picture :D)
Code: (cpp) [Select]

Re: v0.7 panel background textures
« Reply #2 on: 05 September 2015, 01:20:29 »
Ah ok cool. I'll let you know how that goes.

BTW, I really really like the new way of adding widgets to the gui or a container. Also I find the new get method to be able to retrieve the widget pointer really, really useful.

EDIT:- both of the recommendations above worked a treat.
« Last Edit: 05 September 2015, 04:20:27 by starkhorn »