GameMonetize Posted June 1, 2017 Share Posted June 1, 2017 3. You have to save it 6. ok 7. Can you repro in the PG? Quote Link to comment Share on other sites More sharing options...
brianzinn Posted June 1, 2017 Share Posted June 1, 2017 #7 - I had a bit of trouble with domImage too because new Image() has a naming collision, there is a (global?) alias for DomImage outside of the internal module declaration (var DOMImage = Image;). When I moved the GUI code into my project I renamed Image class as ImageControl to avoid the conflict.https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 1, 2017 Share Posted June 1, 2017 2 minutes ago, brianzinn said: #7 - I had a bit of trouble with domImage too because new Image() has a naming collision, there is a (global?) alias for DomImage outside of the internal module declaration (var DOMImage = Image;). When I moved the GUI code into my project I renamed Image class as ImageControl to avoid the conflict.https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image Use babylon gui's namespace - new BABYLON.GUI.Image(), there can't possibly be a conflict. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 1, 2017 Share Posted June 1, 2017 1 hour ago, Deltakosh said: 7. Can you repro in the PG? I think the image is changed properly, but I'm guessing you made domImage only a setter, perhaps add a getter too that returns _domImage? http://www.babylonjs-playground.com/#XCPP9Y#45 Quote Link to comment Share on other sites More sharing options...
brianzinn Posted June 1, 2017 Share Posted June 1, 2017 @royibernthal - I'm using ES6, so I can alias the imports. Is was the code in Image.ts `source` property setter than gave me the issue (this._domImage = new DOMImage();). Anyway, since that is not your issue we can ignore my comment. Cheers. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted June 1, 2017 Share Posted June 1, 2017 Actually, I do have an opinion about the class name, while we are on this topic. I think choosing Image as the name of the class can lead to issues in the future. If somebody does an ES6 import from babylon GUI like: import { Image } from '/babylonjs/gui' Then they will be unable to create an HtmlImageElement with the typical constructor new Image(height, width). They would need to alias the import - ie: import { Image as GuiImage} from 'babylonjs/gui'. So, I would have to say that I think that class name is maybe not the best choice. Looks like it required also a global declaration, which could be clobbered. I have it called ImageControl, so maybe not as good of a name. It's always hard to name things... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 2, 2017 Share Posted June 2, 2017 Naming is Hard @royibernthal: I've added a getter royibernthal 1 Quote Link to comment Share on other sites More sharing options...
BitOfGold Posted June 2, 2017 Share Posted June 2, 2017 How can I update the content of an image button? Or, how can I get the context of the image? I would like to draw an energy level bar, and score, and menu points with pixel font for example. (I can draw pixel fonts to a context, just dont'know how to get it) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 2, 2017 Share Posted June 2, 2017 image button uses an image control (button.children[0]) The image control is this one:http://doc.babylonjs.com/overviews/gui#image You can set the source to an URL to draw the level bar, I recommend just using a rectangle. Menu points could be drawn with TextBlock BitOfGold 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 2, 2017 Author Share Posted June 2, 2017 Hey, I see a slider to add in BABYLON.GUI. It's awesome. I think it's still in the works, but it's cool. Thanks DK Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 2, 2017 Share Posted June 2, 2017 This no longer works: https://www.babylonjs-playground.com/#VAPD0W Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 3, 2017 Author Share Posted June 3, 2017 10 hours ago, royibernthal said: This no longer works: https://www.babylonjs-playground.com/#VAPD0W Works fine for me. Quote Link to comment Share on other sites More sharing options...
royibernthal Posted June 3, 2017 Share Posted June 3, 2017 10 hours ago, Dad72 said: Works fine for me. Try to clear your cache and resize the window, the button should be resized with it. EDIT: oops it shouldn't, I mixed the PGs, sorry about that. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 3, 2017 Share Posted June 3, 2017 ANd here is the slider http://doc.babylonjs.com/overviews/gui#slider Dad72, royibernthal, BitOfGold and 2 others 5 Quote Link to comment Share on other sites More sharing options...
Eugene Posted July 2, 2017 Share Posted July 2, 2017 Tell me please . I can not import BABYLON.GUI Import * as BABYLON from 'babylonjs'; 'Error'message:'Namespace' BABYLON 'has no exported member' GUI ' And when I started importing with help, /// <Reference path = "../../../../ node_modules / babylonjs / dist / preview release / gui / babylon.gui.d.ts" /> I got an exception Error: Uncaught (in promise): ReferenceError: BABYLON is not defined Quote Link to comment Share on other sites More sharing options...
Dad72 Posted July 3, 2017 Author Share Posted July 3, 2017 BABYLON.GUI is an extension that must be added separately to babylon https://github.com/BabylonJS/Babylon.js/tree/master/dist/preview release/gui 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.