Jump to content

Search the Community

Showing results for tags 'text2d'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 12 results

  1. Hi, I have a Text2D in a Rectangle2D, I change the text every 200ms but it does not refresh on the screen. Although when looking at the text property it changes properly. The text refreshes only if I set its levelVisible property on and off at each tic. I do not have this problem in the playground so I am not sure what is going on. state.tic = function () { const text = newText() // this works state.tooltipPause.text.text = text // setting the parent rectangle2d levelVisible // is the only way i have found to refresh the view state.tooltipPause.box.levelVisible = true // delay is simply a promise that will resolve in 200ms delay(200).then(() => { state.tooltipPause.box.levelVisible = false state.tic() }) } Just sharing the little hack I found, in case someone else has the same problem
  2. Hi guys, I'm creating an UI for my babylon game via the Canvas2D, precisely the ScreenSpaceCanvas2D. Now I want to know if it's possible to update the text dynamically without recreating/overwriting the text2d child every time the score variable (which is used for displaying) is updated. Playground link for simplified case: http://www.babylonjs-playground.com/#2AVSFH#271 Thanks in advance!
  3. Hi, I'm trying to show a text label when I hover the mouse over a mesh (sphere). It needs to show up at the exact position of the sphere. Something like: OnPointerOverTrigger -> show text label OnPointerOutTrigger -> hide text label Not sure if I have to use actions... trigger... pick()...text2d. Couldn't figure it out. Is there a way to do it using HTML? Playground: http://www.babylonjs-playground.com/#NH8WYW Can anyone help me? Thanks
  4. Character width calculation is wrong for not mono-spaced fonts. Error is here (BMFontLoaderTxt._buildCharInfo): if (xadv) { width = xadv; } Character width is not always equal to xadv. Try to export Arial from BMFont and look to number characters (48-57) When rendering, wrong part of texture is taken for character. @Nockawa
  5. Sprite2D expects that underlying texture may not be loaded on sprite2d creation. It waits for texture to load, and everything is working fine. But the same problem can arise with Text2D, when using custom font, embedded into css/html. When Text2D object is created, it tries to create font texture, using supplied font parameter. But that font has to be loaded, and that is the process that takes time. So there is no font to use. In Firefox it leads to rendering Text2D objects without any text at all, soft page refresh fixes it. In Chrome one of the system fonts is used instead of required font. Soft page refresh doesn't not fix it, you have to recreate Text2D object. @Nockawa, is there any work around for this? UPD: One can use Bitmap font, that do know about loading time, and waits for underlying texture to load. But is that the only way to deal with the problem?
  6. Th following code was working in previous release (preview), rendering text on two lines: new Text2D("AAA\nBBB", settings) In current release (announced at 29 Jan) it doesn't work. It produces following exception: Uncaught TypeError: Cannot read property 'offset' of undefined at Text2DInstanceData.descriptor.set [as transformX] (http://localhost:63342/FirstSample/lib/babylon.canvas2d.js:8687:66) at Text2D.RenderablePrim2D.updateInstanceDataPart (http://localhost:63342/FirstSample/lib/babylon.canvas2d.js:9337:29) Without new line symbol: new Text2D("AAABBB", settings) it still works
  7. Hi guys. Pinging @Nockawa for this one. I've been working him hard, lately, and I want to thank him for all the recent help. Today I am thinking about borders. Well, I HAVE been thinking about borders for quite some time, but those borders were international borders. Now, about Canvas2D primitives borders. Currently, I think there are only a few ways to make a Canvas2D based border. 1. Rectangle2D 2. Shape2D 3. Sprite2D. Each CAN be used to place a border around a Text2D, or just about anything else. But none of these bordering methods... automatically size-to-fit their contents, right? Perhaps that is reserved for a layer above the currently-completed "base" of Canvas2D. At what point do we "assemble" the FitBorderedText2D and FitBorderedGroup2D? In fact, for maximum-easy bordered tracked-node labeling, I could use a FitBorderedTrackingText2d. It seems strange and clumsy to need Group2D for node tracking, Rectangle2D for text border, and then Text2D... just for a single label. Anyway, I saw mention-of allowing trackNode for WorldSpaceCanvas itself (future feature). That is allowing trackNode on a "higher level" than Group2D. (WSC2D is higher level than a Group2D child of it.) What are the chances of allowing trackNode on LOWER level things... such as Text2D or Rectangle2D? What are the chances of allowing border on Text2D and Group2D? You see, a FitBorderedTrackingText2d... would have a border and trackNode... without needing any help from Rectangle2D or Groupd2D. Potential lines-of-code savings across 10 years of Canvas2D usage - 2 million metric tonnes. Am I de-primitiving the primitives? (i.e. FitBorderedTrackingText2d is a "combo" of primitives, and therefore would be offered on the next layer - the GUI Lib currently under dev?) Perhaps part of a Canvas2D Tools thing... programmer assistance? Of course, programmers can do this "combining" themselves in a little makeLabel() function. But still, I'm curious if Noxxy has any plans for "SuperText2D" features like this. Thoughts, anyone? Thx.
  8. Hi everyone I'm wondering why font size and font rendering is so different when comparing `DynamicTexture` and `Canvas2D` side by side. http://www.babylonjs-playground.com/#TFFCW Note: The huge but blurred text is `8px` while the small and crisp text is `32px` Dynamic texture returns the expected result while text rendered in canvas 2d seems to be way too big and blurry. Of course I could use a bigger font size (ie. 8 times the size needed) and then scale it down (`scale: 0.125`). But I'd like to understand what's going on… Any hint much appreciated! Anyone?
  9. Hey guys, just wondering if there's a way to set the transparency of a Text2D object (or a ScreenSpaceCanvas2D object) after it has been created? I'm assuming this functionality is somewhere but I can't find it or figure it out.
  10. royibernthal

    Text2D Bug

    So far I wasn't able to isolate the problem, so I'll try to give as many details as possible, even though most of them will probably be irrelevant to the bug. I have a ScreenSpaceCanvas2D instance that contains different instances of Group2D, some of those instance contain Text2D and some contain Sprite2D. For future reference "textField" would be a Text2D inside a Group2D inside a ScreenSpaceCanvas2D. Executed one after the other on click events at the same run: textField.text = "0"; -works as expected textField.text = "450"; -only displays "4" textField.text = "500"; -only displays "5" textField.text = "0"; -text now completely disappears, along with the text in another unrelated Text2D, which happens to be a Text2D contained in a different Group2D that is added to ScreenSpaceCanvas2D right after textField's Group2D. Once the text disappears from both Text2D instances it is never displayed again in them no matter what values I try to set in text. No errors are thrown. I failed at reproducing this issue in a PG, I'll keep trying and post it here if I succeed. Hopefully what I wrote would be enough to find the bug. @Nockawa
  11. Is there a way for the Text2D primitive in Canvas2D to load Google Web Fonts? Or any custom font for that matter. It seems to use it only when the font is loaded on your local system. It doesn't use the font that the page loads from Google. Thanks!
  12. Is there a way to create text in text2d which has an outline, something like the image below? I'm going to go ahead and assume the answer to this is no, in which case, could this possibly be added in the future? It's nothing really all that important but it fits with the style of what I'm trying to make. The css solution to this is to use shadows. text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black; Whatever the answer may be, thanks for taking the time!
  • Create New...