diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/_releasenotes b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/_releasenotes
index c1a8b81..64d6c06 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/_releasenotes
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/_releasenotes
@@ -5,3 +5,9 @@
Support scaling sprite groups as if they were one sprite, in multiple dimensions.
Support recoloring groups of sprites
Experimental Clipping Sprite support
+- 1.1.0
+ Reduced runtime memory allocation when rendering drawables.
+ Replaced inefficient LINQ query calls with more performant for and foreach loops.
+ Adjusted documentation and legal notices to correctly refer to the project as Sprite Compositor (instead of Composer)
+ Fix documentation links leading nowhere in some contexts
+ Replaced Angle's inefficient Degrees getter with a more performant syntax
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/_version b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/_version
index afaf360..1cc5f65 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/_version
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/_version
@@ -1 +1 @@
-1.0.0
\ No newline at end of file
+1.1.0
\ No newline at end of file
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/readme.md b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/readme.md
index 1c5a648..1bb8f25 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/readme.md
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/readme.md
@@ -2,9 +2,9 @@
An API wrapper that supports composing new sprites from multiple existing ones.
-- [Source Code](./src)
-- [Demo Project](../SpriteCompositor.Demo/Program.cs)
-- [Tests](../SpriteCompositor.Test)
+- [Source Code](https://github.com/malforge/mdk2-packages/tree/main/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src)
+- [Demo Project](https://github.com/malforge/mdk2-packages/blob/main/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Demo/Program.cs)
+- [Tests](https://github.com/malforge/mdk2-packages/tree/main/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Test)
## Usage
@@ -16,7 +16,7 @@ All sprites and sprite groups implement the `Sprite` interface, which you can us
`Scale()` a sprite after instantiation, among other things. Individual Sprite types may have additional properties and
methods available, like `TextureSprite`'s `Mirror()` functions.
-See the [demo project](../SpriteCompositor.Demo/Program.cs) for a detailed example.
+See the [demo project](https://github.com/malforge/mdk2-packages/blob/main/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Demo/Program.cs) for a detailed example.
### Grouping Sprites
@@ -84,7 +84,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see .
### License
-You can find a copy of the [GNU General Public License](./COPYING) and [GNU Lesser General Public License](./COPYING.LESSER) next to this source code in COPYING and COPYING.LESSER respectively.
+You can find a copy of the [GNU General Public License](https://github.com/malforge/mdk2-packages/blob/main/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/COPYING) and [GNU Lesser General Public License](https://github.com/malforge/mdk2-packages/blob/main/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/COPYING.LESSER) next to this source code in COPYING and COPYING.LESSER respectively.
### Reaching out
You can reach me as @lelebees on Discord, or through the project's [Github Repository](https://github.com/Lelebees/mdk2-packages-sprite-compositor). Please note while reaching out on Discord that I generally do not accept random friend requests. @Mention me in the [programmable block channel](https://discord.com/channels/125011928711036928/216219467959500800) of the Keen Software House Discord Server to get a hold of me.
\ No newline at end of file
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/anchor/Anchor.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/anchor/Anchor.cs
index 2cbe473..07f89de 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/anchor/Anchor.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/anchor/Anchor.cs
@@ -1,14 +1,14 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using VRageMath;
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/anchor/PointAnchor.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/anchor/PointAnchor.cs
index b31b021..1d81ef7 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/anchor/PointAnchor.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/anchor/PointAnchor.cs
@@ -1,14 +1,14 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using VRageMath;
@@ -26,9 +26,6 @@ public PointAnchor(Vector2 position)
public PointAnchor(float x, float y) : this(new Vector2(x, y)) {}
- public Vector2 GetPosition()
- {
- return position;
- }
+ public Vector2 GetPosition() => position;
}
}
\ No newline at end of file
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/angle/Angle.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/angle/Angle.cs
index d8d4d94..35807c7 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/angle/Angle.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/angle/Angle.cs
@@ -1,14 +1,14 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using System;
@@ -51,7 +51,10 @@ private Angle(double radians)
///
/// This angle expressed in degrees, positive or negative, limited to one full rotation (0 to 360)
///
- public double Degrees => Radians * 180 / Math.PI;
+ public double Degrees
+ {
+ get { return Radians * 180 / Math.PI; }
+ }
public static Angle FromDegrees(double degrees) => new Angle(degrees * Math.PI / 180);
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Sprite.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Sprite.cs
index e093636..bc50451 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Sprite.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Sprite.cs
@@ -1,14 +1,14 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using VRage.Game.GUI.TextPanel;
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/SpriteGroup.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/SpriteGroup.cs
index e4130a1..4c8e977 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/SpriteGroup.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/SpriteGroup.cs
@@ -1,18 +1,17 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using System.Collections.Generic;
-using System.Linq;
using VRage.Game.GUI.TextPanel;
using VRageMath;
@@ -23,17 +22,27 @@ public abstract class SpriteGroup : Sprite
public Vector2 GetPosition()
{
var children = GetChildren();
- return children.Aggregate(Vector2.Zero, (current, child) => current + child.GetPosition()) / children.Count;
+ Vector2 result = Vector2.Zero;
+ foreach (var child in children) result += child.GetPosition();
+ return result / children.Count;
}
- public void Translate(Vector2 vector) => GetChildren().ForEach(sprite => sprite.Translate(vector));
+ public void Translate(Vector2 vector)
+ {
+ foreach (var sprite in GetChildren()) sprite.Translate(vector);
+ }
public void Translate(float x, float y) => Translate(new Vector2(x, y));
- public void SetColor(Color color) => GetChildren().ForEach(sprite => sprite.SetColor(color));
+ public void SetColor(Color color)
+ {
+ foreach (var sprite in GetChildren()) sprite.SetColor(color);
+ }
- public void SetAlignment(TextAlignment alignment) =>
- GetChildren().ForEach(sprite => sprite.SetAlignment(alignment));
+ public void SetAlignment(TextAlignment alignment)
+ {
+ foreach (var sprite in GetChildren()) sprite.SetAlignment(alignment);
+ }
public void Scale(float scalar, Anchor anchor = null) => Scale(new Vector2(scalar, scalar), anchor);
@@ -49,7 +58,7 @@ public void Scale(Vector2 scalar, Anchor anchor = null)
anchor = new PointAnchor(anchor.GetPosition());
}
- GetChildren().ForEach(sprite => sprite.Scale(scalar, anchor));
+ foreach (var sprite in GetChildren()) sprite.Scale(scalar, anchor);
}
public void Mirror(Anchor anchor = null) => Scale(new Vector2(-1, -1), anchor);
@@ -67,20 +76,36 @@ public void Rotate(Angle angle, Anchor positionAnchor = null)
{
positionAnchor = new PointAnchor(GetPosition());
}
- if (positionAnchor is SpriteGroup)
+ else if (positionAnchor is SpriteGroup)
{
positionAnchor = new PointAnchor(positionAnchor.GetPosition());
}
- GetChildren().ForEach(sprite => sprite.Rotate(angle, positionAnchor));
+
+ foreach (var sprite in GetChildren())
+ {
+ sprite.Rotate(angle, positionAnchor);
+ }
}
public abstract Sprite Clone();
- public MySprite[] AsDrawableCollection(RectangleF viewport) =>
- GetChildren().SelectMany(child => child.AsDrawableCollection(viewport)).ToArray();
+ public MySprite[] AsDrawableCollection(RectangleF viewport)
+ {
+ List list = new List();
+ foreach (Sprite child in GetChildren())
+ foreach (MySprite sprite in child.AsDrawableCollection(viewport))
+ list.Add(sprite);
+ return list.ToArray();
+ }
- public MySprite[] AsDrawableCollection() =>
- GetChildren().SelectMany(child => child.AsDrawableCollection()).ToArray();
+ public MySprite[] AsDrawableCollection()
+ {
+ List list = new List();
+ foreach (Sprite child in GetChildren())
+ foreach (MySprite sprite in child.AsDrawableCollection())
+ list.Add(sprite);
+ return list.ToArray();
+ }
protected abstract List GetChildren();
}
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/SpriteLeaf.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/SpriteLeaf.cs
index d20381f..96559c1 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/SpriteLeaf.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/SpriteLeaf.cs
@@ -1,14 +1,14 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using System;
@@ -20,6 +20,7 @@ namespace IngameScript
public abstract class SpriteLeaf : Sprite
{
protected MySprite Sprite;
+ private readonly MySprite[] drawable;
public Vector2? Position
{
@@ -30,12 +31,10 @@ public Vector2? Position
protected SpriteLeaf(MySprite sprite)
{
Sprite = sprite;
+ drawable = new[] { Sprite };
}
- public Vector2 GetPosition()
- {
- return Sprite.Position ?? Vector2.Zero;
- }
+ public Vector2 GetPosition() => Sprite.Position ?? Vector2.Zero;
public void Translate(Vector2 vector)
{
@@ -45,20 +44,11 @@ public void Translate(Vector2 vector)
Sprite.Position = position;
}
- public void Translate(float x, float y)
- {
- Translate(new Vector2(x, y));
- }
+ public void Translate(float x, float y) => Translate(new Vector2(x, y));
- public void SetColor(Color color)
- {
- Sprite.Color = color;
- }
+ public void SetColor(Color color) => Sprite.Color = color;
- public void SetAlignment(TextAlignment alignment)
- {
- Sprite.Alignment = alignment;
- }
+ public void SetAlignment(TextAlignment alignment) => Sprite.Alignment = alignment;
public virtual void Scale(float scalar, Anchor anchor = null) => Scale(new Vector2(scalar, scalar), anchor);
@@ -92,23 +82,15 @@ public virtual void Rotate(Angle angle, Anchor positionAnchor = null)
public MySprite[] AsDrawableCollection(RectangleF viewport)
{
- return new[]
- {
- new MySprite(
- Sprite.Type,
- Sprite.Data,
- Sprite.Position + viewport.Center,
- Sprite.Size,
- Sprite.Color,
- Sprite.FontId,
- Sprite.Alignment,
- Sprite.RotationOrScale)
- };
+ drawable[0] = Sprite;
+ drawable[0].Position += viewport.Center;
+ return drawable;
}
public MySprite[] AsDrawableCollection()
{
- return new[] { Sprite };
+ drawable[0] = Sprite;
+ return drawable;
}
}
}
\ No newline at end of file
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Sprites.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Sprites.cs
index 7eb6926..e80d16f 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Sprites.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Sprites.cs
@@ -1,14 +1,14 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using System;
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Textures.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Textures.cs
index fe0617c..07a552d 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Textures.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/Textures.cs
@@ -1,14 +1,14 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
namespace IngameScript
{
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/ClippingSprite.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/ClippingSprite.cs
index d0a1fdf..da8848f 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/ClippingSprite.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/ClippingSprite.cs
@@ -1,14 +1,14 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using VRage.Game.GUI.TextPanel;
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/TextSprite.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/TextSprite.cs
index b3a16b7..91bf414 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/TextSprite.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/TextSprite.cs
@@ -1,14 +1,14 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using VRage.Game.GUI.TextPanel;
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/TextureSprite.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/TextureSprite.cs
index 4280f50..d19b98f 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/TextureSprite.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/atoms/TextureSprite.cs
@@ -1,14 +1,14 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using VRage.Game.GUI.TextPanel;
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/molecules/SimpleSpriteGroup.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/molecules/SimpleSpriteGroup.cs
index ef292d9..bfb7eaf 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/molecules/SimpleSpriteGroup.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/Lelebees.MdkScriptMixin.SpriteCompositor/src/sprite/molecules/SimpleSpriteGroup.cs
@@ -1,18 +1,17 @@
/* Copyright (c) 2026 Lelebees
- This file is part of Sprite Composer.
+ This file is part of Sprite Compositor.
- Sprite Composer is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
+ Sprite Compositor is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
- Sprite Composer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ Sprite Compositor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public License along with Sprite Composer.
+ You should have received a copy of the GNU Lesser General Public License along with Sprite Compositor.
If not, see . */
using System.Collections.Generic;
-using System.Linq;
namespace IngameScript
{
@@ -25,7 +24,13 @@ public SimpleSpriteGroup(List children)
this.children = children;
}
- public override Sprite Clone() => new SimpleSpriteGroup(children.Select(sprite => sprite.Clone()).ToList());
+ public override Sprite Clone()
+ {
+ List list = new List();
+ foreach (var sprite in children) list.Add(sprite.Clone());
+
+ return new SimpleSpriteGroup(list);
+ }
protected override List GetChildren() => children;
}
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Demo/Instructions.readme b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Demo/Instructions.readme
index 0b5aa2b..c4a5e0a 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Demo/Instructions.readme
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Demo/Instructions.readme
@@ -1,2 +1,2 @@
-This program uses SpriteComposer, which is licensed under the GNU LGPL 3.0 or later. You can find the source code and a copy of the license at
+This program uses SpriteCompositor, which is licensed under the GNU LGPL 3.0 or later. You can find the source code and a copy of the license at
Copies of the license are also available at
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Test/src/sprite/atoms/TextSpriteTest.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Test/src/sprite/atoms/TextSpriteTest.cs
index a95eadc..a78ecd2 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Test/src/sprite/atoms/TextSpriteTest.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Test/src/sprite/atoms/TextSpriteTest.cs
@@ -3,6 +3,7 @@
using NUnit.Framework;
using VRage.Game.GUI.TextPanel;
using VRageMath;
+
namespace SpriteCompositor.Test.sprite.atoms
{
[TestFixture]
@@ -89,5 +90,23 @@ public void RenderableDoesNotPropagateChanges()
var newDrawable = sprite.AsDrawableCollection()[0];
Assert.That(newDrawable, Is.Not.EqualTo(mySprite));
}
+
+ [Test]
+ public void RenderableWithViewportDoesNotChangeSprite()
+ {
+ var sprite = Sprites.WithText("uau").Build();
+ var nonProblematicDrawable = sprite.AsDrawableCollection()[0];
+ sprite.AsDrawableCollection(new RectangleF(10, 10, 20, 20));
+ var potentialProblem = sprite.AsDrawableCollection()[0];
+ Assert.That(nonProblematicDrawable, Is.EqualTo(potentialProblem));
+ }
+
+ [Test]
+ public void TransformsApplyToRenderable()
+ {
+ var sprite = Sprites.WithText("uau").Build();
+ sprite.Translate(5,5);
+ Assert.That(sprite.AsDrawableCollection()[0].Position, Is.EqualTo(sprite.Position));
+ }
}
}
\ No newline at end of file
diff --git a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Test/src/sprite/atoms/TextureSpriteTest.cs b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Test/src/sprite/atoms/TextureSpriteTest.cs
index ce75959..51ccd38 100644
--- a/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Test/src/sprite/atoms/TextureSpriteTest.cs
+++ b/libraries/Lelebees.MdkScriptMixin.SpriteCompositor/SpriteCompositor.Test/src/sprite/atoms/TextureSpriteTest.cs
@@ -120,5 +120,23 @@ public void RenderableDoesNotPropagateChanges()
var newDrawable = sprite.AsDrawableCollection()[0];
Assert.That(newDrawable, Is.Not.EqualTo(mySprite));
}
+
+ [Test]
+ public void RenderableWithViewportDoesNotChangeSprite()
+ {
+ var sprite = Sprites.WithTexture("SquareSimple").Build();
+ var nonProblematicDrawable = sprite.AsDrawableCollection()[0];
+ sprite.AsDrawableCollection(new RectangleF(10, 10, 20, 20));
+ var potentialProblem = sprite.AsDrawableCollection()[0];
+ Assert.That(nonProblematicDrawable, Is.EqualTo(potentialProblem));
+ }
+
+ [Test]
+ public void TransformsApplyToRenderable()
+ {
+ var sprite = Sprites.WithText("SquareSimple").Build();
+ sprite.Translate(5,5);
+ Assert.That(sprite.AsDrawableCollection()[0].Position, Is.EqualTo(sprite.Position));
+ }
}
}
\ No newline at end of file