vchelaru / Gum

Flexible layout tool for creating UI on any platform
http://gumui.net/
MIT License
134 stars 27 forks source link

Rendering problem reusing same NinesliceRuntime #186

Closed leandrocurioso closed 1 week ago

leandrocurioso commented 1 week ago

Hi Folks!

I'm creating two textboxes in a form inside the same container, if I reuse the loaded image (my-nineslice.png) that act as a background one of them doesn't render properly.

Is there a limitaton for reusing NineSliceRuntime? I don't want to load twice the same texture. If you guys have any idea about that would it be great!

Tks for now.

vchelaru commented 1 week ago

You should be able to use the same texture across two NineSlice instances without problems.

If you would like to upload some code or a sample project I might be able to give you more info about why it's not working.

vchelaru commented 1 week ago

By the way I've updated the NineSlice code to include more info about setting textures, in case it helps:

https://docs.flatredball.com/gum/monogame/runtime-objects-graphicaluielement-deriving/ninesliceruntime

leandrocurioso commented 1 week ago

@vchelaru thanks for the answer.

This part fully solved my problem. Thanks a lot!

// assuming MyTexture is a valid Texture2D nineSlice.SourceFile = MyTexture;