aboutsummaryrefslogtreecommitdiff
path: root/source/ui/properties/TextProperties.cs
blob: 2ee4deb3efb258b408f49ef347be2ad896fa4163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using Celesteia.Resources;
using Celesteia.Resources.Management;
using Microsoft.Xna.Framework;

namespace Celesteia.UI.Properties {
    public struct TextProperties {
        private string _text;
        private FontType _font;
        private Color _textColor;
        private float _fontSize;
        private TextAlignment _textAlignment;

        public TextProperties Standard() {
            _text = "";
            _font = ResourceManager.Fonts.DEFAULT;
            _textColor = Color.White;
            _fontSize = 16f;
            _textAlignment = TextAlignment.Center;

            return this;
        }

        public TextProperties SetText(string text) {
            _text = text;
            return this;
        }
        public string GetText() => _text;

        public TextProperties SetFont(FontType font) {
            _font = font;
            return this;
        }
        public FontType GetFont() => _font;

        public TextProperties SetColor(Color textColor) {
            _textColor = textColor;
            return this;
        }
        public Color GetColor() => _textColor;
        
        public TextProperties SetFontSize(float fontSize) {
            _fontSize = fontSize;
            return this;
        }
        public float GetFontSize() => _fontSize;

        public TextProperties SetTextAlignment(TextAlignment textAlignment) {
            _textAlignment = textAlignment;
            return this;
        }
        public TextAlignment GetAlignment() => _textAlignment;

        public TextProperties Clone() {
            return new TextProperties()
                .SetColor(_textColor)
                .SetFont(_font)
                .SetFontSize(_fontSize)
                .SetText(_text)
                .SetTextAlignment(_textAlignment);
        }
    }
}