Started by Nafffen, 19 December 2022, 19:38:55
QuoteSprite store a reference to a texture but Picture copies the texture, that why the RAM went up
QuoteIf I add as member of this class sf::Sprite and sf::Text, how will I manage drawing my items in the ScrollPanel with the offset of scrollbar and without going over the edge ? Is sf::RenderTexture a good idea ?
QuoteI really want to have ScrollPanel features so I made a class InventoryWidget, subclass of ScrollPanel but now I am struggling to find the right way to handle item inside
Quotehow will I manage drawing my items in the ScrollPanel with the offset of scrollbar and without going over the edge
QuoteI'm talking about tgui::Text and tgui::Sprite. You mention that Sprite stores a reference, so maybe you are looking at sf::Sprite instead of tgui::Sprite then?
QuoteWhile it could be done, I would not recommend bringing SFML rendering into this. You would have to render the sf::Sprite and sf::Text to a tgui::CanvasSFML widget, which internally uses an sf::RenderTexture as buffer.
QuoteThe alternative would be to copy multiple parts of the ScrollablePanel widget into your own custom widget
QuoteIs there a way to pass sf::Texture to tgui::Picture without copying the data
Quoteif I understand it well, according to your tutorial, InventoryWidget will be subclass of tgui::Widget. I redefined functions I need and in draw function I can reuse (I mean copy appropriate parts of code) the draw function of ScrollPanel, drawing my custom parts inside directly with the BackendRenderTarget reference.