Jump to content

Announcing Babylon.GUI


GameMonetize
 Share

Recommended Posts

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.  :D

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.

Link to comment
Share on other sites

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 ?)

Link to comment
Share on other sites

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 !

Link to comment
Share on other sites

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

Link to comment
Share on other sites

You guys are awesome ! B)

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 ...

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...