-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why are objects like buttons not a slice9? #9
Comments
Hi @zeroZshadow actually the 9 slice skin is the most complexe one, EZGUI support others (not the one you described). it doesn't make the theme definition more complexe because in most cases you only define one corner, one line and one background, the corner will be rotated to create the 3 missing corners ...etc corner-tl/tr/bl/br variants are provided to provide more customisation freedom (let's say you need one corner to be different from the three others ...) (see the wiki for details https://github.com/Ezelia/EZGUI/wiki/01---Themes ) regarding the needed data, it do not make too much difference if you pack all the files in a texture atlas. (one of the provided themes use texture atlas) |
There is no difference in scaling at all though? It only becomes easyer to change a button image as a whole (instead of having to change the seperate images) |
I don't get your point here |
I came here to ask the same question, but it's been closed for nearly a year, so I somewhat despair of getting a better answer.
No, it's not. The image @zeroZshadow posted represents one source image, not 9, and the sub-images are sliced from that one image based on supplied offsets. The Google-defined 9-patch image is even better: The image has a border that defines where the patches are, AND where the padding should go, so you could specify one image with all of the information and simplify the theme definition. As it stands in EZGUI, you have to do the slicing into 9 images yourself. A preprocessing tool can do this slicing for you, but it saves even more space to use proper pixel offsets into a 9-slice image at run time. Especially since EZGUI seems to be forcing all the images to be powers-of-two in size even in an atlas. There are multiple Phaser plug-ins that support this: https://github.com/orange-games/phaser-nineslice Obviously you'd want the code to support PIXI for EZGUI, but it seems like it must be possible. |
Hello @TimMensch , I get it now. take a look at those buttons the usage of dynamic 9 slice hase some simplification for sure, maybe it'll be interesing to provide the option in EZGUI I'll think about it, but it should keep the same logic as the existing theme definitions. about the power of two, EZGUI don't force you to use it, but it's recommanded in all game engines and there's reason for this : GPUs are optimised for PoT images, when used, you get better performance and better quality in image manipulation. |
I just happened across this feature request: In in you say that the four corners need to be the same size; many or most of the buttons in that link you posted wouldn't work with that constraint. And if that's still the case in EZGUI, then you'd need to fix that in order to work with 9-slice. You said that you provide 9, 3, and 1 slice: The "3" case is handled by 9-slice by simply making one dimension have degenerate edges (zero width or zero height). If you are seriously considering adding this as a feature, why not re-open it and mark it as an enhancement? |
Im seeing the buttons have 9 seperate images. But why not have 1 image, and 4 offsets ? (2 vertical slices and 2 horizontal slices)
This should allow but much easyer editing of the one button image, while decreasing the amount of data you need to specify in the theme file.
The text was updated successfully, but these errors were encountered: