mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
whoops
This commit is contained in:
parent
556998239e
commit
347da85b10
1 changed files with 5 additions and 5 deletions
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using Coroutine;
|
using Coroutine;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
@ -96,17 +95,18 @@ namespace Demos {
|
||||||
|
|
||||||
// adding some custom image formatting codes
|
// adding some custom image formatting codes
|
||||||
// note that all added formatting codes need to be lowercase, while their casing doesn't matter when used
|
// note that all added formatting codes need to be lowercase, while their casing doesn't matter when used
|
||||||
TextFormatting.FormattingCodes[new Regex("grass")] = (m, i) => new FormattingCode(i, image.Texture);
|
TextFormatting.FormattingCodes["grass"] = new FormattingCode(image.Texture);
|
||||||
TextFormatting.FormattingCodes[new Regex("tree")] = (m, i) => new FormattingCode(i, tree);
|
TextFormatting.FormattingCodes["tree"] = new FormattingCode(tree);
|
||||||
// formatting codes can also be sprite animations!
|
// formatting codes can also be sprite animations!
|
||||||
var atlas = new UniformTextureAtlas(LoadContent<Texture2D>("Textures/Anim"), 4, 4);
|
var atlas = new UniformTextureAtlas(LoadContent<Texture2D>("Textures/Anim"), 4, 4);
|
||||||
TextFormatting.FormattingCodes[new Regex("walk")] = (m, i) => new FormattingCode(i, new SpriteAnimation(0.2F, atlas[0, 0], atlas[0, 1], atlas[0, 2], atlas[0, 3]));
|
TextFormatting.FormattingCodes["walk"] = new FormattingCode(new SpriteAnimation(0.2F, atlas[0, 0], atlas[0, 1], atlas[0, 2], atlas[0, 3]));
|
||||||
|
|
||||||
root.AddChild(new Paragraph(Anchor.AutoLeft, 1, "Additionally, you can create custom formatting codes that contain [Grass] images or [Walk] sprite animations! Note that these images have to be square, or [Tree] bad things happen."));
|
root.AddChild(new Paragraph(Anchor.AutoLeft, 1, "Additionally, you can create custom formatting codes that contain [Grass] images or [Walk] sprite animations! Note that these images have to be square, or [Tree] bad things happen."));
|
||||||
|
|
||||||
var animatedPar = root.AddChild(new Paragraph(Anchor.AutoLeft, 1, "Defining text animations as formatting codes is also possible, including [Wobbly]wobbly text[Unanimated] as well as a [Typing]dialogue-esc typing effect by default. Of course, more animations can be added though."));
|
var animatedPar = root.AddChild(new Paragraph(Anchor.AutoLeft, 1, "Defining text animations as formatting codes is also possible, including [Wobbly]wobbly text[Unanimated] as well as a [Typing]dialogue-esc typing effect by default. Of course, more animations can be added though."));
|
||||||
root.AddChild(new Button(Anchor.AutoCenter, new Vector2(1, 10), "Reset Typing Animation") {
|
root.AddChild(new Button(Anchor.AutoCenter, new Vector2(1, 10), "Reset Typing Animation") {
|
||||||
OnPressed = e => animatedPar.FormattingCodes.Reset()
|
// to reset any animation, simply change the paragraph's TimeIntoAnimation
|
||||||
|
OnPressed = e => animatedPar.TimeIntoAnimation = TimeSpan.Zero
|
||||||
});
|
});
|
||||||
|
|
||||||
root.AddChild(new VerticalSpace(3));
|
root.AddChild(new VerticalSpace(3));
|
||||||
|
|
Loading…
Reference in a new issue