Best method to implement 9 slice?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- ShoesForClues
- Prole
- Posts: 15
- Joined: Wed Dec 12, 2018 1:43 pm
Best method to implement 9 slice?
I'm currently working on a GUI framework and I'm trying to implement 9 slice in order to properly scale windows and borders. What's the best way to go around this? I'm aware that you could use quads to only draw certain parts of an image, but is that more efficient than just using setScissor?
Re: Best method to implement 9 slice?
It's more efficient as changing the scissorrect will stop batching, so you'll create 9 draw calls. Also using scissors will be more complicated to implement as scissors are in screen coordinates, i.e. pixels, so you'd have to do more transformation work on your coordinates (in case you use any scaling while drawing but given the huge difference of monitor resolutions this is highly expected).
Also, if a 9 slice doesn't change often, you may add all the 9 quads manually into a spritebatch and only change it if you required (or create a mesh).
Also, if a 9 slice doesn't change often, you may add all the 9 quads manually into a spritebatch and only change it if you required (or create a mesh).
- CrimsonGuy
- Prole
- Posts: 48
- Joined: Thu Apr 04, 2019 3:32 pm
Re: Best method to implement 9 slice?
https://love2d.org/forums/viewtopic.php ... ce#p227190
Found a kinda recent thread about this question.
Found a kinda recent thread about this question.
Re: Best method to implement 9 slice?
Finally a good explanation of what that enumtype does.
I’ve been waiting a long time to know how it works.
(Has no information on the wiki, except the tiny bit I added, which lacks about everything related to this)
I’ve been waiting a long time to know how it works.
(Has no information on the wiki, except the tiny bit I added, which lacks about everything related to this)
Who is online
Users browsing this forum: Ahrefs [Bot] and 7 guests