RonenNess / GeonBit.UI

UI system for MonoGame projects.
MIT License
467 stars 63 forks source link

TypeWriterParagraph initial #100

Closed BlizzCrafter closed 5 years ago

BlizzCrafter commented 5 years ago

The TypeWriterParagraph adds the type writer effect to text. It inherits from MultiColorParagraph to support multiple colors.

As I inherited from the MultiColorParagraph I noticed that the drawing of the outline is the same code block as used by the base Paragraph class (compare Paragraph vs MultiColorParagraph)

So I decided to wrap this up in a protected void to make it available in derived classes like the MultiColorParagraph and the new TypeWriterParagraph.

Commit 9e6c93e opens up some important members of the MultiColorParagraph so that classes that inherit from it (like the new TypeWriterParagraph) can benefit from.

It's possible to change the speed of the type writer effect by overloading the ctor and modifying the timeBetweenChars value.


This is just the basic implementation with a basic effect. In the future this TypeWriterParagraph could be modified to work the same way as the MultiColorParagraph by setting speed values directly in the text (like a ColorInstruction).

RonenNess commented 5 years ago

Hi @sqrMin1, thank you very much for this pull request! While your improvements are very good (and nicely written) I will not merge them because I finally got to implement two things I wanted to do for a while now, which makes your PR redundant:

  1. Refactored MultiColorParagraph into RichParagraph which also allow to control font style (bold / italid / regular) and outline via instructions. 059778931d3c3dbfaaa3d61cdee93663abf86c33
  2. Added animators, which are objects responsible to animate different entities. One of the built-in animators implement typewriting. e08c7f1339bc98622febc8c9085f66a13ebdb703

Hope you find the new version useful (its not out yet but stable if you want to build it), I think it adds really nice features. It does break the API a little bit but nothing too complicated to update.

Cheers :)

BlizzCrafter commented 5 years ago

Hey @RonenNess

You are enhancing the library in an even better way. Looking forward to the new release! 👍

(animations would have been next on my list, hehe)