Hi,
Did anyone has any idea how to create a 9 Patch Sprite or Helper?
Thanks,
Hi,
Did anyone has any idea how to create a 9 Patch Sprite or Helper?
Thanks,
UI BorderImage works exactly this way. I hope it won’t be a problem to reproduce the logic for 2D graphics.
Hi Eugene,
What is the limitation of BorderImage, can this do exactly same with what sprite2d do?
The limitation is that BorderImage is UI element and not designed to be a part of the scene.
So I don’t recommend to use it as is. You will have more problems than benefits.
However, you could check the code (that is pretty simple) and tune Sprite2D to allow it be 9-stretchable (it would be great to get this feature in Urho core).
You could also ask somebody on forums (e.g. me) to implement this feature, but keep in mind that we are all volunteers here. I could investigate a bit this weekend.
Noted with thanks.
FYI. Just checked code.
It’s pretty easy to change StaticSprite2D::UpdateSourceBatches
so it will make nine quads instead of one.
If you are familiar with C++, you could do it on your own. If you are not, please make an issue on GitHub tracker.
However, there is some design complexity. How to specify inner rectangle for StaticSprite2D
?
It could be
Any ideas?
Hi Eugene,
Thanks for the suggestion, I’m new to urho3d, it is complicated for me to create my own. ( afraid causing other feature issue but I don’t know )
However, how can I avoid this issue when using normal
StaticSprite2D?
For instance,
Don’t make square image to be long rect image
and?
To keep things simple - but not ideal - you could make an Object
or Component
that simply creates and keeps track of nine separate sprites.
From there it may be easier to turn it into a single Drawable
.
The simplest workaround is to use fixed-size sprites.
Then, you could create a component (as @Modanung suggested) for 9-sprite that uses 9 StaticSprite2D-s.
But such feature is better to be in Urho core IMO.