TypingLabel - Simulates text being typed in real time.

Any community contributions to libgdx go here! Some may get included in the core API when permission is granted.

Re: TypingLabel - Simulates text being typed in real time.

Postby wizered67 » Sun Feb 26, 2017 10:06 pm

Wow, that was really fast! Both the API changes were really helpful and I was able to get everything working in a much nicer way than before.

Okay, one more thing I'm stuck on that I think an API addition would be needed for. I'm trying to get my saving and loading system (using Kryo) working with this. I've been able to get it partially working so far. When I save, I store getOriginalText. Then, when I load I just restart the TypingLabel with that as its text. The problem is that this doesn't store the progression of the text, and as far as I can tell there isn't anyway to do so. Would you consider adding a way to get the progress of the text (ie how far it has scrolled) and a way to force set the progress to a certain point. I imagine it would ideally be like skipToEnd, including options to skip effects and skip events, but instead of going to the end it goes to a specific point in text. Thanks again so much!
wizered67
 
Posts: 19
Joined: Wed May 25, 2016 6:32 am

Re: TypingLabel - Simulates text being typed in real time.

Postby wizered67 » Thu May 18, 2017 11:57 pm

I've found a bug that I was hoping you could take a look at when you have the chance. Resizing the window while text is being typed will sometimes cause the text to get messed up and start overlapping itself. Here's a screenshot so you can see what I mean.
Image

I tested with and without Tokens in the text and the bug appeared either way. Usually the overlapping text issue goes away if the screen is resized again, so I thought maybe the layout method wasn't getting called the first time but that doesn't seem to be the case. I took a look through the code to see if I could figure out the cause but I wasn't able to so I was hoping you could take a look. Overall though your TypingLabel has been great and a pleasure to use. Thanks so much for making it!
wizered67
 
Posts: 19
Joined: Wed May 25, 2016 6:32 am

Re: TypingLabel - Simulates text being typed in real time.

Postby RafaSKB » Fri May 19, 2017 5:44 am

Uh oh, this is bad. I'll take a look into it as soon as possible (probably next week). I think the fix should be simple enough, a recalculation of the glyph positions when a resize happens.

I will also see if I can add the cursor/index getter and setters you suggested before, sorry for missing your post.

Thanks for the report, and I'm glad the library is useful! :mrgreen: :mrgreen:
Junk E.T. - A garbage-themed roguelike where you travel through the galaxy to collect mankind's waste and turn into a profit.
- http://www.junketgame.com
RafaSKB
 
Posts: 70
Joined: Sat Aug 01, 2015 5:14 am
Location: São Paulo, Brazil

Re: TypingLabel - Simulates text being typed in real time.

Postby wizered67 » Fri May 19, 2017 11:37 pm

Thanks a lot! I appreciate all the help!
wizered67
 
Posts: 19
Joined: Wed May 25, 2016 6:32 am

Re: TypingLabel - Simulates text being typed in real time.

Postby common_goblin » Wed May 24, 2017 5:30 pm

Hi

First of all just wanted to say thanks heaps for TypingLabel - made my little typewriter class very ashamed.

I'm having some problems with the type speed when including new lines in my text. When I include new lines I seem to get sem-random pauses just after it, and sometimes I get characters cut off at the end (stops typing before it reaches the end of the string).

I'm able to reproduce it in the demo - by changing StringBuilder text in the method createTypingLabel() to:

Code: Select all
      final StringBuilder text = new StringBuilder()
         .append("this is the first line")
         .append(System.lineSeparator())
         .append("there is a second line right here")
         .append(System.lineSeparator())
         .append("of course there is a third line too")
         .append(System.lineSeparator())
         .append("fourth line - almost at the end")
         .append(System.lineSeparator())
         .append("this is the final line");


The same problem exists when using "\n" instead of System.lineSeparator().

I'm wondering if this is a bug or if I'm just doing something incorrectly? Or if there's a workaround?

I also seem to be getting garbled glyphs when I use a font over a certain font size (around 90, but it depends on the font - I'm using Hiero to generate bitmap fonts). I guess it sounds like what wizered67 was describing here - though I can't view the linked image anymore (can post a screenshot if it's helpful).
common_goblin
 
Posts: 2
Joined: Wed May 24, 2017 4:42 pm

Re: TypingLabel - Simulates text being typed in real time.

Postby wizered67 » Wed May 24, 2017 9:22 pm

Common_goblin, I can answer part of your question from my experience with this. The delays after newline characters is actually part of the default configuration. You can fix it by doing TypingConfig.INTERVAL_MULTIPLIERS_BY_CHAR.put ("\n", 0). By default it is given a very long delay!
wizered67
 
Posts: 19
Joined: Wed May 25, 2016 6:32 am

Re: TypingLabel - Simulates text being typed in real time.

Postby common_goblin » Thu May 25, 2017 8:48 am

Thanks so much! I can't believe I missed that, it's so obvious...

Speed is perfect now.

Thanks again!
common_goblin
 
Posts: 2
Joined: Wed May 24, 2017 4:42 pm

Re: TypingLabel - Simulates text being typed in real time.

Postby wizered67 » Sat Jul 15, 2017 9:26 pm

Hey RafaSKB, just wondering if you've made any progress on the fixes? No rush though!
wizered67
 
Posts: 19
Joined: Wed May 25, 2016 6:32 am

Previous

Return to Libgdx Contributions

Who is online

Users browsing this forum: No registered users and 1 guest