diff --git a/Demos.Android/Properties/AndroidManifest.xml b/Demos.Android/Properties/AndroidManifest.xml
index 00885a3..8211e7d 100644
--- a/Demos.Android/Properties/AndroidManifest.xml
+++ b/Demos.Android/Properties/AndroidManifest.xml
@@ -1,5 +1,6 @@
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/Demos.Android/Resources/Values/Strings.xml b/Demos.Android/Resources/Values/Strings.xml
index c8bc5fe..c0092a0 100644
--- a/Demos.Android/Resources/Values/Strings.xml
+++ b/Demos.Android/Resources/Values/Strings.xml
@@ -1,4 +1,5 @@
+
- MLEM Android Demos
-
+ MLEM Android Demos
+
\ No newline at end of file
diff --git a/MLEM.Data/RuntimeTexturePacker.cs b/MLEM.Data/RuntimeTexturePacker.cs
index 1936e93..dcdf5ba 100644
--- a/MLEM.Data/RuntimeTexturePacker.cs
+++ b/MLEM.Data/RuntimeTexturePacker.cs
@@ -113,7 +113,7 @@ namespace MLEM.Data {
if (this.forceSquare)
width = height = Math.Max(width, height);
this.PackedTexture = new Texture2D(device, width, height);
-
+
// copy texture data onto the packed texture
stopwatch.Restart();
using (var data = this.PackedTexture.GetTextureData()) {
diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs
index b294127..cc1d0f9 100644
--- a/MLEM.Ui/Elements/Panel.cs
+++ b/MLEM.Ui/Elements/Panel.cs
@@ -49,8 +49,8 @@ namespace MLEM.Ui.Elements {
this.CanBeSelected = false;
if (scrollOverflow) {
- var scrollSize = scrollerSize ?? Point.Zero;
- this.ScrollBar = new ScrollBar(Anchor.TopRight, new Vector2(scrollSize.X, 1), scrollSize.Y, 0) {
+ var (w, h) = scrollerSize ?? Point.Zero;
+ this.ScrollBar = new ScrollBar(Anchor.TopRight, new Vector2(w, 1), h, 0) {
StepPerScroll = 10,
OnValueChanged = (element, value) => this.ScrollChildren(),
CanAutoAnchorsAttach = false,
@@ -59,9 +59,9 @@ namespace MLEM.Ui.Elements {
};
// modify the padding so that the scroll bar isn't over top of something else
- this.ScrollBar.PositionOffset -= new Vector2(scrollSize.X + 1, 0);
+ this.ScrollBar.PositionOffset -= new Vector2(w + 1, 0);
if (autoHideScrollbar)
- this.ScrollBar.OnAutoHide += e => this.ChildPadding += new Padding(0, scrollSize.X, 0, 0) * (e.IsHidden ? -1 : 1);
+ this.ScrollBar.OnAutoHide += e => this.ChildPadding += new Padding(0, w, 0, 0) * (e.IsHidden ? -1 : 1);
// handle automatic element selection, the scroller needs to scroll to the right location
this.OnSelectedElementChanged += (element, otherElement) => {
diff --git a/MLEM.Ui/Elements/Paragraph.cs b/MLEM.Ui/Elements/Paragraph.cs
index 138adb7..9f42051 100644
--- a/MLEM.Ui/Elements/Paragraph.cs
+++ b/MLEM.Ui/Elements/Paragraph.cs
@@ -98,8 +98,8 @@ namespace MLEM.Ui.Elements {
protected override Vector2 CalcActualSize(RectangleF parentArea) {
var size = base.CalcActualSize(parentArea);
this.ParseText(size);
- var dims = this.TokenizedText.Measure(this.RegularFont) * this.TextScale * this.TextScaleMultiplier * this.Scale;
- return new Vector2(this.AutoAdjustWidth ? dims.X + this.ScaledPadding.Width : size.X, dims.Y + this.ScaledPadding.Height);
+ var (w, h) = this.TokenizedText.Measure(this.RegularFont) * this.TextScale * this.TextScaleMultiplier * this.Scale;
+ return new Vector2(this.AutoAdjustWidth ? w + this.ScaledPadding.Width : size.X, h + this.ScaledPadding.Height);
}
///
diff --git a/MLEM.Ui/Elements/Tooltip.cs b/MLEM.Ui/Elements/Tooltip.cs
index 5b7eaca..168ea4a 100644
--- a/MLEM.Ui/Elements/Tooltip.cs
+++ b/MLEM.Ui/Elements/Tooltip.cs
@@ -84,16 +84,16 @@ namespace MLEM.Ui.Elements {
/// Causes this tooltip's position to be snapped to the mouse position.
///
public void SnapPositionToMouse() {
- var viewport = this.System.Viewport.Size;
+ var (w, h) = this.System.Viewport.Size;
var offset = (this.Input.MousePosition.ToVector2() + this.MouseOffset.Value) / this.Scale;
if (offset.X < 0)
offset.X = 0;
if (offset.Y < 0)
offset.Y = 0;
- if (offset.X * this.Scale + this.Area.Width >= viewport.X)
- offset.X = (viewport.X - this.Area.Width) / this.Scale;
- if (offset.Y * this.Scale + this.Area.Height >= viewport.Y)
- offset.Y = (viewport.Y - this.Area.Height) / this.Scale;
+ if (offset.X * this.Scale + this.Area.Width >= w)
+ offset.X = (w - this.Area.Width) / this.Scale;
+ if (offset.Y * this.Scale + this.Area.Height >= h)
+ offset.Y = (h - this.Area.Height) / this.Scale;
this.PositionOffset = offset;
}
diff --git a/MLEM/Formatting/Codes/UnderlineCode.cs b/MLEM/Formatting/Codes/UnderlineCode.cs
index c5aa633..806575d 100644
--- a/MLEM/Formatting/Codes/UnderlineCode.cs
+++ b/MLEM/Formatting/Codes/UnderlineCode.cs
@@ -23,9 +23,9 @@ namespace MLEM.Formatting.Codes {
// don't underline spaces at the end of lines
if (c == ' ' && this.Token.DisplayString.Length > indexInToken + 1 && this.Token.DisplayString[indexInToken + 1] == '\n')
return false;
- var size = font.MeasureString(cString) * scale;
- var thicc = size.Y * this.thickness;
- batch.Draw(batch.GetBlankTexture(), new RectangleF(pos.X, pos.Y + this.yOffset * size.Y - thicc, size.X, thicc), color);
+ var (w, h) = font.MeasureString(cString) * scale;
+ var t = h * this.thickness;
+ batch.Draw(batch.GetBlankTexture(), new RectangleF(pos.X, pos.Y + this.yOffset * h - t, w, t), color);
return false;
}
diff --git a/MLEM/Misc/AutoTiling.cs b/MLEM/Misc/AutoTiling.cs
index caf3997..04c33ef 100644
--- a/MLEM/Misc/AutoTiling.cs
+++ b/MLEM/Misc/AutoTiling.cs
@@ -39,12 +39,12 @@ namespace MLEM.Misc {
var xDl = down && left ? connectsTo(-1, 1) ? 0 : 4 : left ? 1 : down ? 3 : 2;
var xDr = down && right ? connectsTo(1, 1) ? 0 : 4 : right ? 1 : down ? 3 : 2;
- var size = textureRegion.Size;
- var halfSize = new Point(size.X / 2, size.Y / 2);
- batch.Draw(texture, new Vector2(pos.X, pos.Y), new Rectangle(textureRegion.X + 0 + xUl * size.X, textureRegion.Y + 0, halfSize.X, halfSize.Y), color, rotation, org, sc, SpriteEffects.None, layerDepth);
- batch.Draw(texture, new Vector2(pos.X + 0.5F * size.X * sc.X, pos.Y), new Rectangle(textureRegion.X + halfSize.X + xUr * size.X, textureRegion.Y + 0, halfSize.X, halfSize.Y), color, rotation, org, sc, SpriteEffects.None, layerDepth);
- batch.Draw(texture, new Vector2(pos.X, pos.Y + 0.5F * size.Y * sc.Y), new Rectangle(textureRegion.X + xDl * size.X, textureRegion.Y + halfSize.Y, halfSize.X, halfSize.Y), color, rotation, org, sc, SpriteEffects.None, layerDepth);
- batch.Draw(texture, new Vector2(pos.X + 0.5F * size.X * sc.X, pos.Y + 0.5F * size.Y * sc.Y), new Rectangle(textureRegion.X + halfSize.X + xDr * size.X, textureRegion.Y + halfSize.Y, halfSize.X, halfSize.Y), color, rotation, org, sc, SpriteEffects.None, layerDepth);
+ var (w, h) = textureRegion.Size;
+ var (w2, h2) = new Point(w / 2, h / 2);
+ batch.Draw(texture, new Vector2(pos.X, pos.Y), new Rectangle(textureRegion.X + 0 + xUl * w, textureRegion.Y + 0, w2, h2), color, rotation, org, sc, SpriteEffects.None, layerDepth);
+ batch.Draw(texture, new Vector2(pos.X + 0.5F * w * sc.X, pos.Y), new Rectangle(textureRegion.X + w2 + xUr * w, textureRegion.Y + 0, w2, h2), color, rotation, org, sc, SpriteEffects.None, layerDepth);
+ batch.Draw(texture, new Vector2(pos.X, pos.Y + 0.5F * h * sc.Y), new Rectangle(textureRegion.X + xDl * w, textureRegion.Y + h2, w2, h2), color, rotation, org, sc, SpriteEffects.None, layerDepth);
+ batch.Draw(texture, new Vector2(pos.X + 0.5F * w * sc.X, pos.Y + 0.5F * h * sc.Y), new Rectangle(textureRegion.X + w2 + xDr * w, textureRegion.Y + h2, w2, h2), color, rotation, org, sc, SpriteEffects.None, layerDepth);
}
///
diff --git a/MLEM/Misc/Direction2.cs b/MLEM/Misc/Direction2.cs
index 971717b..4a52861 100644
--- a/MLEM/Misc/Direction2.cs
+++ b/MLEM/Misc/Direction2.cs
@@ -179,8 +179,8 @@ namespace MLEM.Misc {
/// The direction whose angle to get
/// The direction's angle
public static float Angle(this Direction2 dir) {
- var offset = dir.Offset();
- return (float) Math.Atan2(offset.Y, offset.X);
+ var (x, y) = dir.Offset();
+ return (float) Math.Atan2(y, x);
}
///
diff --git a/Tests/CollectionTests.cs b/Tests/CollectionTests.cs
index f8eab18..b7e69c6 100644
--- a/Tests/CollectionTests.cs
+++ b/Tests/CollectionTests.cs
@@ -11,14 +11,14 @@ namespace Tests {
new[] {'A', 'B'},
new[] {'+', '-'}
};
-
+
var expected = new[] {
new[] {'1', 'A', '+'}, new[] {'1', 'A', '-'}, new[] {'1', 'B', '+'}, new[] {'1', 'B', '-'},
new[] {'2', 'A', '+'}, new[] {'2', 'A', '-'}, new[] {'2', 'B', '+'}, new[] {'2', 'B', '-'},
new[] {'3', 'A', '+'}, new[] {'3', 'A', '-'}, new[] {'3', 'B', '+'}, new[] {'3', 'B', '-'}
};
Assert.AreEqual(things.Combinations(), expected);
-
+
var indices = new[] {
new[] {0, 0, 0}, new[] {0, 0, 1}, new[] {0, 1, 0}, new[] {0, 1, 1},
new[] {1, 0, 0}, new[] {1, 0, 1}, new[] {1, 1, 0}, new[] {1, 1, 1},
diff --git a/Tests/DataTests.cs b/Tests/DataTests.cs
index 32e5718..e9a0c47 100644
--- a/Tests/DataTests.cs
+++ b/Tests/DataTests.cs
@@ -64,7 +64,7 @@ namespace Tests {
}
public override bool Equals(object obj) {
- return ReferenceEquals(this, obj) || obj is TestObject other && Equals(other);
+ return ReferenceEquals(this, obj) || obj is TestObject other && this.Equals(other);
}
public override int GetHashCode() {