aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-12 20:32:28 -0400
committerMichael <[email protected]>2017-05-12 20:32:28 -0400
commitc18c0fbc325b1c6a0864f88c6e2f4d2889d62e18 (patch)
tree1688b7c14f37fc0942e3b2c71a133aed3b9eee0e /ShiftOS_TheReturn
parentbded9d1250575e6b9824be9048ac7ac8669a303b (diff)
downloadshiftos_thereturn-c18c0fbc325b1c6a0864f88c6e2f4d2889d62e18.tar.gz
shiftos_thereturn-c18c0fbc325b1c6a0864f88c6e2f4d2889d62e18.tar.bz2
shiftos_thereturn-c18c0fbc325b1c6a0864f88c6e2f4d2889d62e18.zip
dithering revamp
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/Commands.cs17
-rw-r--r--ShiftOS_TheReturn/Skinning.cs19
2 files changed, 36 insertions, 0 deletions
diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs
index d622bb9..5b7674a 100644
--- a/ShiftOS_TheReturn/Commands.cs
+++ b/ShiftOS_TheReturn/Commands.cs
@@ -233,6 +233,23 @@ namespace ShiftOS.Engine
[Namespace("dev")]
public static class ShiftOSDevCommands
{
+ [Command("buy")]
+ public static bool UnlockUpgrade(Dictionary<string, object> args)
+ {
+ string upg = args["id"].ToString();
+ try
+ {
+ SaveSystem.CurrentSave.Upgrades[upg] = true;
+ Shiftorium.InvokeUpgradeInstalled();
+ SaveSystem.SaveGame();
+ }
+ catch
+ {
+ Console.WriteLine("Upgrade not found.");
+ }
+ return true;
+ }
+
[Command("rock", description = "A little surprise for unstable builds...")]
public static bool ThrowASandwichingRock()
{
diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs
index b731c4f..548e80f 100644
--- a/ShiftOS_TheReturn/Skinning.cs
+++ b/ShiftOS_TheReturn/Skinning.cs
@@ -66,6 +66,13 @@ namespace ShiftOS.Engine
public static class SkinEngine
{
+ private static ISkinPostProcessor processor = null;
+
+ public static void SetPostProcessor(ISkinPostProcessor _processor)
+ {
+ processor = _processor;
+ }
+
public static ImageLayout GetImageLayout(string img)
{
if (LoadedSkin.SkinImageLayouts.ContainsKey(img))
@@ -93,6 +100,8 @@ namespace ShiftOS.Engine
if (iattr.Name == img)
{
byte[] image = (byte[])field.GetValue(LoadedSkin);
+ if (processor != null)
+ image = processor.ProcessImage(image);
return ImageFromBinary(image);
}
}
@@ -1323,6 +1332,16 @@ namespace ShiftOS.Engine
public string Category { get; set; }
}
+ public interface ISkinPostProcessor
+ {
+ /// <summary>
+ /// Perform algorithmic operations at the bit level on a ShiftOS skin image.
+ /// </summary>
+ /// <param name="original">The image, as loaded by the engine, as a 32-bit ARGB byte array.</param>
+ /// <returns>The processed image.</returns>
+ byte[] ProcessImage(byte[] original);
+ }
+
public class ShifterMetaAttribute : Attribute
{