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

Pages: [1]
Wow, hats off for you for such speed

It would be certainly convenient for me, but question is whether there is some greater need for this feature.

I need the callback when mouse goes down and then also when mouse goes up.

I can simulate it from outside code, I just wanted to know whether there is easy way to do it or maybe error on my side.

I have a tgui::Canvas object, to which I connected events using "MousePressed":

auto canvas = tgui::Canvas::create();
canvas->connect("MousePressed", [this]() { /*...*/ });

But it seems the event is only triggered on left mouse click, not on right mouse click.

Is there any way to trigger on both?

Feature requests / Re: setTextureRect on Renderers
« on: 01 September 2019, 15:46:43 »
Thanks for clarification, this is really helpful

Feature requests / Re: setTextureRect on Renderers
« on: 31 August 2019, 22:36:16 »
Sorry for the later reply, I somehow missed your post.
The setTexture takes a tgui::Texture as parameter which already has the ability to load only a part of an image. Assuming myTilesetTexture is an sf::Texture, you can just do the following:
btn->getRenderer()->setTexture({myTilesetTexture, {16, 0, 16, 16}});

Thanks, this solves my problem! One more question though - what happens under the hood? Does this perform a conversion to sf::Image and back to texture or does this computation run directly on GPU?

Feature requests / setTextureRect on Renderers
« on: 29 August 2019, 12:23:31 »
Could you please add function setTextureRect to Renderers such as ButtonRenderer with the same semantics as sf::Sprite::setTextureRect?
So far, I cannot find a way how to display only a subset of a texture on a button.

Example usage:
auto btn = tgui::Button::create();
btn->getRenderer()->setTexture(myTilesetTexture); // tileset of 16x16 images
btn->getRenderer()->setTextureRect(sf::IntRect(16, 0, 16, 16)); // displaying second image
btn->setSize(16, 16);


Help requests / Re: Accessing Picture's underlying sprite
« on: 19 November 2017, 17:26:04 »
This solution works perfectly, does what I need with minimal effort to update my code, thanks :)

Help requests / Re: TransparentGrey and BabyBlue themes bug
« on: 19 November 2017, 15:14:14 »
Yup, this works, sorry for the duplicate. Looking forward for 0.7.6 :)

Help requests / TransparentGrey and BabyBlue themes bug
« on: 19 November 2017, 15:04:54 »

I ran into a problem when experimenting with themes bundled with tgui (v0.7). I have copied whole widgets folder to my project's folder. I managed to load theme Black.txt and create ChildWindow from it without any problems (using relative paths). But when I try to load either TransparentGrey or BabyBlue, program throws an exception at the moment where ChildWindow should be created.

The problem is not in paths. I have copied whole contents of TransparentGrey over original content of Black and program crashed too. I restored original Black's contents and program ran just fine. Also I've only copied ChildWindow section from TransparentGrey into Black and overwritten original Black's ChildWindow. That worked. So I assume that somewhere in both TransparentGrey and BabyBlue there is some syntax error.

Help requests / Accessing Picture's underlying sprite
« on: 19 November 2017, 14:58:02 »

I am working on a drawing application and I need buttons with icons of various tools (brush, can, etc) that change color based on color selection. So far I am doing it via sf::Sprite that has texture bound to it and calling Sprite::setColor whenever I need to. And I catch the clicks with invisible panel hidden behind it.

But that creates an issue since I have to draw the Sprites after the gui is drawn and thus any elements that possibly can overlap these buttons will be rendered under the Sprites. I was wondering whether I can use something like tgui::Picture to do the job, but unfortunately I can't find a way to access it's underlying sprite (or whatever it uses for rendering).

In the end, Picture renders a texture so there has to be a way to set color to it as well.
Thanks for any tips

Pages: [1]