nouknouk Posted October 21, 2014 Share Posted October 21, 2014 Hi,And first congrats to the author for this amazing lib.just wondered to be able to take one png image, instanciate a Sprite and declare top, left, right, bottom border sizes, and finally get a ninepatch sprite (*), for example to easily render buttons with different sizes.Is it possible 'out of the box' with Pixi?If not, where should I start to look at in order to ceate such specialized class?Thanks in advance for you advices :-)(*)like: http://yannickloriot.com/2013/03/9-patch-technique-in-cocos2d/ Quote Link to comment Share on other sites More sharing options...
powerfear Posted October 21, 2014 Share Posted October 21, 2014 I think SebastianNette did a a Ninepatch for pixi here: http://www.html5gamedevs.com/topic/9668-pixi-input-elements/?p=58455 Quote Link to comment Share on other sites More sharing options...
Sebi Posted October 21, 2014 Share Posted October 21, 2014 Yes! There is a NinePatch here: https://github.com/SebastianNette/PIXI.NinePatch It's really easy to use.Simply load the pixi.ninepatch.js after you have loaded pixi.js. It took me only a few minutes to write that container, so there might be some bugs. If you find any, please report them to me! Usage:var ninepatch = new PIXI.NinePatch(100, 30, "img/yellow_button_0*.png", false);stage.addChild(ninepatch);The asterisk is replaced by the numbers 1-9, where 1 is the top left corner and 9 is the bottom right corner. 1,2,34,5,67,8,9 You can either use images or frames. That's what the fourth parameter is for. true for frames, false for images. A demo can be found here: http://mokgames.com/playground/pixi/ninepatch/ Keep in mind, that everything you place in the body container is currently scaled up.I will fix that later this day by adding another DisplayObjectContainer for the body and head properties of my ninepatch. Quote Link to comment Share on other sites More sharing options...
TungLT Posted January 25, 2016 Share Posted January 25, 2016 I'm using EZGUI to build a mini game. And when i use your plugin to make a nine-patch image, it didn't work correctly. Can you fix that ? Quote Link to comment Share on other sites More sharing options...
patrickfabrizius Posted February 20, 2016 Share Posted February 20, 2016 On 2016-01-25 at 0:24 PM, TungLT said: I'm using EZGUI to build a mini game. And when i use your plugin to make a nine-patch image, it didn't work correctly. Can you fix that ? Could you be more specific as to what doesn't work, any devices in particular, etc? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.