GameMonetize Posted October 25, 2017 Author Share Posted October 25, 2017 @adam: this could be worth an update to GUI doc pichou 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted October 27, 2017 Share Posted October 27, 2017 Hi guys! Goofy Wingnut Idea: var options = {down: onPointerDownFunc, up: onPointerUpFunc, enter: onPointerEnterFunc, out: onPointerOutFunc, move: onPointerMoveFunc}; var button1 = BABYLON.GUI.Button.CreateSimpleButton("but1", "Click Me", options); This would automatically "observer-up" the button with full power... and no need to add observers. Observers would be done in framework code... based upon options parameter. It seems to be a great place for Wingnut to perform a typo in the function name, and get a Function Not Found error. Thoughts? Derivatives? (thx) https://www.babylonjs-playground.com/#XCPP9Y#304 There sure is a LOT of code in there... for 4 buttons. I should probably do some rectangle.shallowClone() stuff, eh? (ShallowClone is just like clone, except it doesn't clone the children/contained items. (more goofy stuff from Wingnut) Don't try it, it hasn't yet been invented, and likely never will be. I think clone() has an optional flag to "go deep" (clone the children, too). Or maybe there is no clone() for GUI controls, yet, or ever. Arte and phaselock 2 Quote Link to comment Share on other sites More sharing options...
phaselock Posted November 1, 2017 Share Posted November 1, 2017 Hi again, so nice to see the GUI evolving. May I know if the current babylon GUI has capability to read icons from an icon atlas ? Where the position and size of the icon is stored in , say, a JSON file ? Looking at the source today, I don't see that capability but I tot I'd ask just in case. If not, would it be useful for babylon to have this functionality? Again, just throwing out the idea to the devs and community for feedback. Personally, I don't think it would be difficult to code the loader and make an extension. But it would be MUCH FASTER to simply have it in babylon itself. (Off my head, a little addition to image.ts and buttons.ts should work ?) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 1, 2017 Author Share Posted November 1, 2017 Hello, there is no json support per se as it is too much linked to application data but you can use the image control to display an icon from an image: http://doc.babylonjs.com/how_to/gui#image (You can use the sourceXXX properties to specify where the icon is) phaselock 1 Quote Link to comment Share on other sites More sharing options...
phaselock Posted November 2, 2017 Share Posted November 2, 2017 5 hours ago, Deltakosh said: Hello, there is no json support per se as it is too much linked to application data but you can use the image control to display an icon from an image: I see, understood, thanks. Guess I'll code my own loader, cheers ! fyi: editing the image props from button looks clunky (https://www.babylonjs-playground.com/#XCPP9Y#309), a simple QoL fix if anyone's up for it, cheers ! Wingnut 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 2, 2017 Author Share Posted November 2, 2017 What do you mean by clunky? Quote Link to comment Share on other sites More sharing options...
adam Posted November 2, 2017 Share Posted November 2, 2017 16 hours ago, phaselock said: I see, understood, thanks. Guess I'll code my own loader, cheers ! fyi: editing the image props from button looks clunky (https://www.babylonjs-playground.com/#XCPP9Y#309), a simple QoL fix if anyone's up for it, cheers ! I'd stay away from referencing private vars: https://www.babylonjs-playground.com/#XCPP9Y#312 edit: and sourceLeft, sourceTop is already 0: https://www.babylonjs-playground.com/#XCPP9Y#313 phaselock 1 Quote Link to comment Share on other sites More sharing options...
adam Posted November 2, 2017 Share Posted November 2, 2017 You can also use getChildByName: https://www.babylonjs-playground.com/#XCPP9Y#314 phaselock 1 Quote Link to comment Share on other sites More sharing options...
phaselock Posted November 3, 2017 Share Posted November 3, 2017 You guys are awesome ! 9 hours ago, Deltakosh said: What do you mean by clunky? I'd prefer something like CreateImageOnlyButton("button", image) as opposed to CreateImageOnlyButton("button", "imageURL"). Don't need getChildByName (user needs to know the name, duh), don't need to spend time figuring out where the vars are, and user still have full control over the image vars etc etc. Shrugs, small stuff really ... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 3, 2017 Author Share Posted November 3, 2017 ok gotcha but in this case you are forced to create the image so it is 50/50 Quote Link to comment Share on other sites More sharing options...
dvdarias Posted November 7, 2017 Share Posted November 7, 2017 Amazing library!!!! Is there a way to set the anchor of a GUI element? The properties: transformCenterX, transformCenterY only work after all computations are done. For example, I would like the grass image to be aligned to the left inside of its container and keep the uniform scaling. I would be able to do this if I could change the anchor of the image or set the horizontal alignment but is not working as I expected : (. https://www.babylonjs-playground.com/#VHMNDR#1 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.