Jump to content

.setText() slow?


Oyed
 Share

Recommended Posts

Using the .setText() method on text already added in to a Stage isn't instant - for example, if I call .setText() before a FOR loop, the FOR loop will execute before the text has actually been set.

 

Is there a way around this? I've heard Bitmap fonts are good for this, but I can't use a Bitmap font at this stage of the application (The issue is happening on the preloading screen).

Link to comment
Share on other sites

This is because setText stores the value and sets the dirty flag, then when the render loop comes around it rerenders itself.

If you need to update the text immediately, you can call .updateText() directly. That will redraw the text object to the new text you had previously set.

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