Skip to content

Commit

Permalink
Add NeoText property for control character substitution
Browse files Browse the repository at this point in the history
  • Loading branch information
Evrim Öztamur committed Sep 28, 2020
1 parent e4f9d95 commit ac63144
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Dungeoneer/src/com/interrupt/dungeoneer/entities/NeoText.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class NeoText extends DirectionalEntity {
@EditorProperty
public DrawableText.TextAlignment textAlignment = DrawableText.TextAlignment.CENTER;

@EditorProperty
public boolean substituteControlLiterals;

public NeoText() {
this.drawable = new DrawableText(this.text);
this.isDynamic = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ public void update(Entity e) {

if (e instanceof NeoText) {
NeoText parentNeoText = (NeoText)e;
text = parentNeoText.text;
text = text.replace("\\n", "\n"); // Hack in support for newlines in the editor.

color.set(parentNeoText.textColor);

text = parentNeoText.text;

if (parentNeoText.substituteControlLiterals) {
text = text.replace("\\n", "\n"); // Hack in support for newlines in the editor.
}

switch (parentNeoText.textAlignment) {
case LEFT:
alignmentOffset = 0.0f; break;
Expand Down

0 comments on commit ac63144

Please sign in to comment.