diff --git a/2DGAMELIB/2DGAMELIB.csproj b/2DGAMELIB/2DGAMELIB.csproj
index 1972427..c327328 100644
--- a/2DGAMELIB/2DGAMELIB.csproj
+++ b/2DGAMELIB/2DGAMELIB.csproj
@@ -9,7 +9,7 @@
AnyCPU
- 10.0
+ 9.0
True
diff --git a/2DGAMELIB/System.Diagnostics.CodeAnalysis/AllowNullAttribute.cs b/2DGAMELIB/System.Diagnostics.CodeAnalysis/AllowNullAttribute.cs
index 2c0b581..f4eb282 100644
--- a/2DGAMELIB/System.Diagnostics.CodeAnalysis/AllowNullAttribute.cs
+++ b/2DGAMELIB/System.Diagnostics.CodeAnalysis/AllowNullAttribute.cs
@@ -1,6 +1,9 @@
-namespace System.Diagnostics.CodeAnalysis;
-
-[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
-internal sealed class AllowNullAttribute : Attribute
+namespace System.Diagnostics.CodeAnalysis
{
+
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
+ internal sealed class AllowNullAttribute : Attribute
+ {
+ }
+
}
\ No newline at end of file
diff --git a/2DGAMELIB/System.Diagnostics.CodeAnalysis/DoesNotReturnIfAttribute.cs b/2DGAMELIB/System.Diagnostics.CodeAnalysis/DoesNotReturnIfAttribute.cs
index ecea437..326b380 100644
--- a/2DGAMELIB/System.Diagnostics.CodeAnalysis/DoesNotReturnIfAttribute.cs
+++ b/2DGAMELIB/System.Diagnostics.CodeAnalysis/DoesNotReturnIfAttribute.cs
@@ -1,12 +1,13 @@
-namespace System.Diagnostics.CodeAnalysis;
-
-[AttributeUsage(AttributeTargets.Parameter)]
-internal class DoesNotReturnIfAttribute : Attribute
+namespace System.Diagnostics.CodeAnalysis
{
- public DoesNotReturnIfAttribute(bool parameterValue)
+ [AttributeUsage(AttributeTargets.Parameter)]
+ internal class DoesNotReturnIfAttribute : Attribute
{
- ParameterValue = parameterValue;
- }
+ public DoesNotReturnIfAttribute(bool parameterValue)
+ {
+ ParameterValue = parameterValue;
+ }
- public bool ParameterValue { get; }
+ public bool ParameterValue { get; }
+ }
}
\ No newline at end of file
diff --git a/2DGAMELIB/System.Diagnostics.CodeAnalysis/MaybeNullAttribute.cs b/2DGAMELIB/System.Diagnostics.CodeAnalysis/MaybeNullAttribute.cs
index 698fadc..0926438 100644
--- a/2DGAMELIB/System.Diagnostics.CodeAnalysis/MaybeNullAttribute.cs
+++ b/2DGAMELIB/System.Diagnostics.CodeAnalysis/MaybeNullAttribute.cs
@@ -1,7 +1,8 @@
-namespace System.Diagnostics.CodeAnalysis;
-
-[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter |
- AttributeTargets.ReturnValue)]
-internal sealed class MaybeNullAttribute : Attribute
+namespace System.Diagnostics.CodeAnalysis
{
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter |
+ AttributeTargets.ReturnValue)]
+ internal sealed class MaybeNullAttribute : Attribute
+ {
+ }
}
\ No newline at end of file
diff --git a/2DGAMELIB/System.Diagnostics.CodeAnalysis/NotNullAttribute.cs b/2DGAMELIB/System.Diagnostics.CodeAnalysis/NotNullAttribute.cs
index 8732b20..45e55f0 100644
--- a/2DGAMELIB/System.Diagnostics.CodeAnalysis/NotNullAttribute.cs
+++ b/2DGAMELIB/System.Diagnostics.CodeAnalysis/NotNullAttribute.cs
@@ -1,8 +1,9 @@
-namespace System.Diagnostics.CodeAnalysis;
-
-[AttributeUsage(
- AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter |
- AttributeTargets.ReturnValue, AllowMultiple = true)]
-internal sealed class NotNullAttribute : Attribute
+namespace System.Diagnostics.CodeAnalysis
{
+ [AttributeUsage(
+ AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter |
+ AttributeTargets.ReturnValue, AllowMultiple = true)]
+ internal sealed class NotNullAttribute : Attribute
+ {
+ }
}
\ No newline at end of file
diff --git a/2DGAMELIB/System.Diagnostics.CodeAnalysis/NotNullWhenAttribute.cs b/2DGAMELIB/System.Diagnostics.CodeAnalysis/NotNullWhenAttribute.cs
index 1f4b3aa..df85a9e 100644
--- a/2DGAMELIB/System.Diagnostics.CodeAnalysis/NotNullWhenAttribute.cs
+++ b/2DGAMELIB/System.Diagnostics.CodeAnalysis/NotNullWhenAttribute.cs
@@ -1,12 +1,13 @@
-namespace System.Diagnostics.CodeAnalysis;
-
-[AttributeUsage(AttributeTargets.Parameter)]
-internal sealed class NotNullWhenAttribute : Attribute
+namespace System.Diagnostics.CodeAnalysis
{
- public NotNullWhenAttribute(bool returnValue)
+ [AttributeUsage(AttributeTargets.Parameter)]
+ internal sealed class NotNullWhenAttribute : Attribute
{
- ReturnValue = returnValue;
- }
+ public NotNullWhenAttribute(bool returnValue)
+ {
+ ReturnValue = returnValue;
+ }
- public bool ReturnValue { get; }
+ public bool ReturnValue { get; }
+ }
}
\ No newline at end of file
diff --git a/2DGAMELIB/_2DGAMELIB/Are.cs b/2DGAMELIB/_2DGAMELIB/Are.cs
index f13c881..4dcef5f 100644
--- a/2DGAMELIB/_2DGAMELIB/Are.cs
+++ b/2DGAMELIB/_2DGAMELIB/Are.cs
@@ -2,200 +2,201 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
-namespace _2DGAMELIB;
-
-public class Are : Rect
+namespace _2DGAMELIB
{
- public Bitmap Dis;
-
- protected Graphics gd;
-
- protected Bitmap Hit;
-
- protected Graphics gh;
-
- protected double unit;
-
- protected double disUnit;
-
- protected double hitUnit;
-
- protected Size WH = System.Drawing.Size.Empty;
-
- protected Size WHH = System.Drawing.Size.Empty;
-
- protected Size WHA = System.Drawing.Size.Empty;
-
- private Color ClearColor = Color.Transparent;
-
- public Vector2D BasePoint = Dat.Vec2DZero;
-
- public Vector2D Position = Dat.Vec2DZero;
-
- protected Vector2D p;
-
- protected Rectangle r;
-
- protected ColorMatrix cm = new ColorMatrix();
-
- protected ImageAttributes ia = new ImageAttributes();
-
- protected InterpolationMode im;
-
- public Graphics GD => gd;
-
- public Graphics GH => gh;
-
- public double Unit => unit;
-
- public double DisUnit => disUnit;
-
- public Are() { }
- public Are(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag)
- {
- Setting(Unit, XRatio, YRatio, Size, DisMag, HitMag);
- }
-
- public Are(Med Med, bool Hit)
- {
- if (Hit)
- {
- Setting(Med.Unit, Med.Base.XRatio, Med.Base.YRatio, Med.Base.Size, Med.DisQuality, Med.HitAccuracy);
- }
- else
- {
- Setting(Med.Unit, Med.Base.XRatio, Med.Base.YRatio, Med.Base.Size, Med.DisQuality);
- }
- }
- private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag)
+ public class Are : Rect
{
- SetXYRatio(XRatio, YRatio);
- base.Size = Size;
- unit = Unit;
- disUnit = Unit * DisMag;
- WH.Width = (int)(base.LocalWidth * Unit);
- WH.Height = (int)(base.LocalHeight * Unit);
- WHA.Width = (int)(base.LocalWidth * disUnit);
- WHA.Height = (int)(base.LocalHeight * disUnit);
- Dis = new Bitmap((int)((double)WH.Width * DisMag), (int)((double)WH.Height * DisMag));
- gd = Graphics.FromImage(Dis);
+ public Bitmap Dis;
+
+ protected Graphics gd;
+
+ protected Bitmap Hit;
+
+ protected Graphics gh;
+
+ protected double unit;
+
+ protected double disUnit;
+
+ protected double hitUnit;
+
+ protected Size WH = System.Drawing.Size.Empty;
+
+ protected Size WHH = System.Drawing.Size.Empty;
+
+ protected Size WHA = System.Drawing.Size.Empty;
+
+ private Color ClearColor = Color.Transparent;
+
+ public Vector2D BasePoint = Dat.Vec2DZero;
+
+ public Vector2D Position = Dat.Vec2DZero;
+
+ protected Vector2D p;
+
+ protected Rectangle r;
+
+ protected ColorMatrix cm = new ColorMatrix();
+
+ protected ImageAttributes ia = new ImageAttributes();
+
+ protected InterpolationMode im;
+
+ public Graphics GD => gd;
+
+ public Graphics GH => gh;
+
+ public double Unit => unit;
+
+ public double DisUnit => disUnit;
+
+ public Are() { }
+ public Are(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag)
+ {
+ Setting(Unit, XRatio, YRatio, Size, DisMag, HitMag);
+ }
+
+ public Are(Med Med, bool Hit)
+ {
+ if (Hit)
+ {
+ Setting(Med.Unit, Med.Base.XRatio, Med.Base.YRatio, Med.Base.Size, Med.DisQuality, Med.HitAccuracy);
+ }
+ else
+ {
+ Setting(Med.Unit, Med.Base.XRatio, Med.Base.YRatio, Med.Base.Size, Med.DisQuality);
+ }
+ }
+ private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag)
+ {
+ SetXYRatio(XRatio, YRatio);
+ base.Size = Size;
+ unit = Unit;
+ disUnit = Unit * DisMag;
+ WH.Width = (int)(base.LocalWidth * Unit);
+ WH.Height = (int)(base.LocalHeight * Unit);
+ WHA.Width = (int)(base.LocalWidth * disUnit);
+ WHA.Height = (int)(base.LocalHeight * disUnit);
+ Dis = new Bitmap((int)((double)WH.Width * DisMag), (int)((double)WH.Height * DisMag));
+ gd = Graphics.FromImage(Dis);
- gd.SmoothingMode = SmoothingMode.None;
- gd.PixelOffsetMode = PixelOffsetMode.HighSpeed;
- gd.InterpolationMode = InterpolationMode.NearestNeighbor;
- //needed for text or smthn
- gd.CompositingMode = CompositingMode.SourceOver;
+ gd.SmoothingMode = SmoothingMode.None;
+ gd.PixelOffsetMode = PixelOffsetMode.HighSpeed;
+ gd.InterpolationMode = InterpolationMode.NearestNeighbor;
+ //needed for text or smthn
+ gd.CompositingMode = CompositingMode.SourceOver;
+ }
+ private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag)
+ {
+ Setting(Unit, XRatio, YRatio, Size, DisMag);
+
+ hitUnit = Unit * HitMag;
+ WHH.Width = (int)(base.LocalWidth * hitUnit);
+ WHH.Height = (int)(base.LocalHeight * hitUnit);
+ Hit = new Bitmap(WHH.Width, WHH.Height);
+ gh = Graphics.FromImage(Hit);
+
+
+ gh.SmoothingMode = SmoothingMode.None;
+ gh.PixelOffsetMode = PixelOffsetMode.HighSpeed;
+ gh.InterpolationMode = InterpolationMode.NearestNeighbor;
+ gh.CompositingMode = CompositingMode.SourceCopy;
+ }
+
+ public Vector2D GetPosition()
+ {
+ return new Vector2D(Position.X - BasePoint.X * XRatio * Size, Position.Y - BasePoint.Y * YRatio * Size);
+ }
+
+
+
+
+
+ public void Draw(Par Par)
+ {
+ Par.Draw(disUnit, gd);
+ if (gh != null)
+ {
+ Par.DrawH(hitUnit, gh);
+ }
+ }
+
+ public void Draw(ParT ParT)
+ {
+ ParT.Draw(disUnit, gd);
+ if (gh != null)
+ {
+ ParT.DrawH(hitUnit, gh);
+ }
+ }
+
+ public void Draw(Pars Pars)
+ {
+ Pars.Draw(disUnit, gd);
+ if (gh != null)
+ {
+ Pars.DrawH(hitUnit, gh);
+ }
+ }
+
+ public void Draw(Graphics GD)
+ {
+ p = GetPosition();
+ GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
+ }
+
+ public void Draw(Graphics GD, Graphics GH)
+ {
+ p = GetPosition();
+ GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
+ if (gh != null)
+ {
+ GH.DrawImage(Hit, (int)(p.X * hitUnit), (int)(p.Y * hitUnit), WHH.Width, WHH.Height);
+ }
+ }
+
+ public void Draw(Are Are)
+ {
+ p = Are.GetPosition();
+ GD.DrawImage(Are.Dis, (float)(p.X * Are.disUnit), (float)(p.Y * Are.disUnit), Are.WHA.Width, Are.WHA.Height);
+ if (Are.gh != null && GH != null)
+ {
+ GH.DrawImage(Are.Hit, (int)(p.X * Are.hitUnit), (int)(p.Y * Are.hitUnit), Are.WHH.Width, Are.WHH.Height);
+ }
+ }
+
+
+
+
+
+ public void Clear()
+ {
+ gd.Clear(ClearColor);
+ if (gh != null)
+ {
+ gh.Clear(ClearColor);
+ }
+ }
+
+ public void Clear(Color Color)
+ {
+ gd.Clear(Color);
+ if (gh != null)
+ {
+ gh.Clear(ClearColor);
+ }
+ }
+
+ public void Dispose()
+ {
+ Dis.Dispose();
+ gd.Dispose();
+ if (Hit != null)
+ {
+ Hit.Dispose();
+ gh.Dispose();
+ }
+ }
}
- private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag)
- {
- Setting(Unit, XRatio, YRatio, Size, DisMag);
-
- hitUnit = Unit * HitMag;
- WHH.Width = (int)(base.LocalWidth * hitUnit);
- WHH.Height = (int)(base.LocalHeight * hitUnit);
- Hit = new Bitmap(WHH.Width, WHH.Height);
- gh = Graphics.FromImage(Hit);
-
-
- gh.SmoothingMode = SmoothingMode.None;
- gh.PixelOffsetMode = PixelOffsetMode.HighSpeed;
- gh.InterpolationMode = InterpolationMode.NearestNeighbor;
- gh.CompositingMode = CompositingMode.SourceCopy;
- }
-
- public Vector2D GetPosition()
- {
- return new Vector2D(Position.X - BasePoint.X * XRatio * Size, Position.Y - BasePoint.Y * YRatio * Size);
- }
-
-
-
-
-
- public void Draw(Par Par)
- {
- Par.Draw(disUnit, gd);
- if (gh != null)
- {
- Par.DrawH(hitUnit, gh);
- }
- }
-
- public void Draw(ParT ParT)
- {
- ParT.Draw(disUnit, gd);
- if (gh != null)
- {
- ParT.DrawH(hitUnit, gh);
- }
- }
-
- public void Draw(Pars Pars)
- {
- Pars.Draw(disUnit, gd);
- if (gh != null)
- {
- Pars.DrawH(hitUnit, gh);
- }
- }
-
- public void Draw(Graphics GD)
- {
- p = GetPosition();
- GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
- }
-
- public void Draw(Graphics GD, Graphics GH)
- {
- p = GetPosition();
- GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
- if (gh != null)
- {
- GH.DrawImage(Hit, (int)(p.X * hitUnit), (int)(p.Y * hitUnit), WHH.Width, WHH.Height);
- }
- }
-
- public void Draw(Are Are)
- {
- p = Are.GetPosition();
- GD.DrawImage(Are.Dis, (float)(p.X * Are.disUnit), (float)(p.Y * Are.disUnit), Are.WHA.Width, Are.WHA.Height);
- if (Are.gh != null && GH != null)
- {
- GH.DrawImage(Are.Hit, (int)(p.X * Are.hitUnit), (int)(p.Y * Are.hitUnit), Are.WHH.Width, Are.WHH.Height);
- }
- }
-
-
-
-
-
- public void Clear()
- {
- gd.Clear(ClearColor);
- if (gh != null)
- {
- gh.Clear(ClearColor);
- }
- }
-
- public void Clear(Color Color)
- {
- gd.Clear(Color);
- if (gh != null)
- {
- gh.Clear(ClearColor);
- }
- }
-
- public void Dispose()
- {
- Dis.Dispose();
- gd.Dispose();
- if (Hit != null)
- {
- Hit.Dispose();
- gh.Dispose();
- }
- }
}
diff --git a/2DGAMELIB/_2DGAMELIB/AreM.cs b/2DGAMELIB/_2DGAMELIB/AreM.cs
index 2b4663a..731eca2 100644
--- a/2DGAMELIB/_2DGAMELIB/AreM.cs
+++ b/2DGAMELIB/_2DGAMELIB/AreM.cs
@@ -1,84 +1,85 @@
using System.Drawing;
using System.Drawing.Drawing2D;
-namespace _2DGAMELIB;
-
-public class AreM : Are
+namespace _2DGAMELIB
{
- private double strength;
+ public class AreM : Are
+ {
+ private double strength;
- private double unitS;
+ private double unitS;
- public AreM(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag, double Strength)
- {
- Setting(Unit, XRatio, YRatio, Size, DisMag, HitMag, Strength);
- }
+ public AreM(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag, double Strength)
+ {
+ Setting(Unit, XRatio, YRatio, Size, DisMag, HitMag, Strength);
+ }
- private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag, double Strength)
- {
- SetXYRatio(XRatio, YRatio);
- base.Size = Size;
- unit = Unit;
- strength = Strength;
- disUnit = Unit * DisMag;
- double num = 1.0 - Strength;
- unitS = disUnit * num;
- WH.Width = (int)(base.LocalWidth * Unit);
- WH.Height = (int)(base.LocalHeight * Unit);
- WHA.Width = (int)(base.LocalWidth * disUnit);
- WHA.Height = (int)(base.LocalHeight * disUnit);
- Dis = new Bitmap((int)((double)WH.Width * DisMag * num), (int)((double)WH.Height * DisMag * num));
- gd = Graphics.FromImage(Dis);
- gd.SmoothingMode = SmoothingMode.None;
- gd.PixelOffsetMode = PixelOffsetMode.None;
- hitUnit = Unit * HitMag;
- WHH.Width = (int)(base.LocalWidth * hitUnit);
- WHH.Height = (int)(base.LocalHeight * hitUnit);
- Hit = new Bitmap(WHH.Width, WHH.Height);
- gh = Graphics.FromImage(Hit);
- gh.SmoothingMode = SmoothingMode.None;
- gh.PixelOffsetMode = PixelOffsetMode.None;
- }
+ private void Setting(double Unit, double XRatio, double YRatio, double Size, double DisMag, double HitMag, double Strength)
+ {
+ SetXYRatio(XRatio, YRatio);
+ base.Size = Size;
+ unit = Unit;
+ strength = Strength;
+ disUnit = Unit * DisMag;
+ double num = 1.0 - Strength;
+ unitS = disUnit * num;
+ WH.Width = (int)(base.LocalWidth * Unit);
+ WH.Height = (int)(base.LocalHeight * Unit);
+ WHA.Width = (int)(base.LocalWidth * disUnit);
+ WHA.Height = (int)(base.LocalHeight * disUnit);
+ Dis = new Bitmap((int)((double)WH.Width * DisMag * num), (int)((double)WH.Height * DisMag * num));
+ gd = Graphics.FromImage(Dis);
+ gd.SmoothingMode = SmoothingMode.None;
+ gd.PixelOffsetMode = PixelOffsetMode.None;
+ hitUnit = Unit * HitMag;
+ WHH.Width = (int)(base.LocalWidth * hitUnit);
+ WHH.Height = (int)(base.LocalHeight * hitUnit);
+ Hit = new Bitmap(WHH.Width, WHH.Height);
+ gh = Graphics.FromImage(Hit);
+ gh.SmoothingMode = SmoothingMode.None;
+ gh.PixelOffsetMode = PixelOffsetMode.None;
+ }
- public new void Draw(ParT ParT)
- {
- ParT.Draw(unitS, gd);
- if (gh != null)
- {
- ParT.DrawH(hitUnit, gh);
- }
- }
+ public new void Draw(ParT ParT)
+ {
+ ParT.Draw(unitS, gd);
+ if (gh != null)
+ {
+ ParT.DrawH(hitUnit, gh);
+ }
+ }
- public new void Draw(Pars Pars)
- {
- Pars.Draw(unitS, gd);
- if (gh != null)
- {
- Pars.DrawH(hitUnit, gh);
- }
- }
- public new void Draw(Graphics GD)
- {
- im = GD.InterpolationMode;
- GD.InterpolationMode = InterpolationMode.NearestNeighbor;
- p = GetPosition();
- GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
- GD.InterpolationMode = im;
- }
+ public new void Draw(Pars Pars)
+ {
+ Pars.Draw(unitS, gd);
+ if (gh != null)
+ {
+ Pars.DrawH(hitUnit, gh);
+ }
+ }
+ public new void Draw(Graphics GD)
+ {
+ im = GD.InterpolationMode;
+ GD.InterpolationMode = InterpolationMode.NearestNeighbor;
+ p = GetPosition();
+ GD.DrawImage(Dis, (int)(p.X * unit), (int)(p.Y * unit), WH.Width, WH.Height);
+ GD.InterpolationMode = im;
+ }
- public new void Draw(Graphics GD, double Opacity)
- {
- im = GD.InterpolationMode;
- GD.InterpolationMode = InterpolationMode.NearestNeighbor;
- cm.Matrix33 = (float)Opacity;
- ia.SetColorMatrix(cm);
- p = GetPosition();
- r.X = (int)(p.X * unit);
- r.Y = (int)(p.Y * unit);
- r.Width = WH.Width;
- r.Height = WH.Height;
- GD.DrawImage(Dis, r, 0, 0, Dis.Width, Dis.Height, GraphicsUnit.Pixel, ia);
- GD.InterpolationMode = im;
- }
+ public new void Draw(Graphics GD, double Opacity)
+ {
+ im = GD.InterpolationMode;
+ GD.InterpolationMode = InterpolationMode.NearestNeighbor;
+ cm.Matrix33 = (float)Opacity;
+ ia.SetColorMatrix(cm);
+ p = GetPosition();
+ r.X = (int)(p.X * unit);
+ r.Y = (int)(p.Y * unit);
+ r.Width = WH.Width;
+ r.Height = WH.Height;
+ GD.DrawImage(Dis, r, 0, 0, Dis.Width, Dis.Height, GraphicsUnit.Pixel, ia);
+ GD.InterpolationMode = im;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/But.cs b/2DGAMELIB/_2DGAMELIB/But.cs
index 4227b53..52f4352 100644
--- a/2DGAMELIB/_2DGAMELIB/But.cs
+++ b/2DGAMELIB/_2DGAMELIB/But.cs
@@ -1,166 +1,167 @@
using System;
using System.Drawing;
-namespace _2DGAMELIB;
-
-public class But
+namespace _2DGAMELIB
{
- private bool dra = true;
+ public class But
+ {
+ private bool dra = true;
- private Color hc = Color.Transparent;
+ private Color hc = Color.Transparent;
- protected Pars pars;
+ protected Pars pars;
- protected Action Over = delegate
- {
- };
+ protected Action Over = delegate
+ {
+ };
- protected Action Push = delegate
- {
- };
+ protected Action Push = delegate
+ {
+ };
- protected Action Release = delegate
- {
- };
+ protected Action Release = delegate
+ {
+ };
- protected Action Out = delegate
- {
- };
+ protected Action Out = delegate
+ {
+ };
- public Action Action = delegate
- {
- };
+ public Action Action = delegate
+ {
+ };
- private bool f1;
+ private bool f1;
- private bool f2;
+ private bool f2;
- public bool Dra
- {
- get
- {
- return dra;
- }
- set
- {
- Move(ref hc);
- dra = value;
- }
- }
+ public bool Dra
+ {
+ get
+ {
+ return dra;
+ }
+ set
+ {
+ Move(ref hc);
+ dra = value;
+ }
+ }
- public Pars Pars => pars;
+ public Pars Pars => pars;
- public But(Par Par, Action Action)
- {
- pars = new Pars(Par);
- this.Action = Action;
- }
+ public But(Par Par, Action Action)
+ {
+ pars = new Pars(Par);
+ this.Action = Action;
+ }
- public But(ParT ParT, Action Action)
- {
- pars = new Pars(ParT);
- this.Action = Action;
- }
+ public But(ParT ParT, Action Action)
+ {
+ pars = new Pars(ParT);
+ this.Action = Action;
+ }
- public But(Pars Pars, Action Action)
- {
- pars = Pars;
- this.Action = Action;
- }
+ public But(Pars Pars, Action Action)
+ {
+ pars = Pars;
+ this.Action = Action;
+ }
- public bool Move(ref Color HitColor)
- {
- if (Dra && !f2 && pars.IsHit(ref HitColor))
- {
- f2 = true;
- Over(this);
- return true;
- }
- if (Dra && f2 && !pars.IsHit(ref HitColor))
- {
- f1 = false;
- f2 = false;
- Out(this);
- return true;
- }
- return false;
- }
+ public bool Move(ref Color HitColor)
+ {
+ if (Dra && !f2 && pars.IsHit(ref HitColor))
+ {
+ f2 = true;
+ Over(this);
+ return true;
+ }
+ if (Dra && f2 && !pars.IsHit(ref HitColor))
+ {
+ f1 = false;
+ f2 = false;
+ Out(this);
+ return true;
+ }
+ return false;
+ }
- public bool Leave()
- {
- if (Dra && f2)
- {
- f1 = false;
- f2 = false;
- Out(this);
- return true;
- }
- return false;
- }
+ public bool Leave()
+ {
+ if (Dra && f2)
+ {
+ f1 = false;
+ f2 = false;
+ Out(this);
+ return true;
+ }
+ return false;
+ }
- public bool Down(ref Color HitColor)
- {
- if (Dra && !f1 && pars.IsHit(ref HitColor))
- {
- f1 = true;
- Push(this);
- return true;
- }
- return false;
- }
+ public bool Down(ref Color HitColor)
+ {
+ if (Dra && !f1 && pars.IsHit(ref HitColor))
+ {
+ f1 = true;
+ Push(this);
+ return true;
+ }
+ return false;
+ }
- public bool Up(ref Color HitColor)
- {
- if (Dra && f1 && pars.IsHit(ref HitColor))
- {
- f1 = false;
- Release(this);
- Action(this);
- return true;
- }
- return false;
- }
+ public bool Up(ref Color HitColor)
+ {
+ if (Dra && f1 && pars.IsHit(ref HitColor))
+ {
+ f1 = false;
+ Release(this);
+ Action(this);
+ return true;
+ }
+ return false;
+ }
- public void Draw(Are Are)
- {
- if (dra)
- {
- Are.Draw(pars);
- }
- }
+ public void Draw(Are Are)
+ {
+ if (dra)
+ {
+ Are.Draw(pars);
+ }
+ }
- public void Draw(AreM AreM)
- {
- if (dra)
- {
- AreM.Draw(pars);
- }
- }
+ public void Draw(AreM AreM)
+ {
+ if (dra)
+ {
+ AreM.Draw(pars);
+ }
+ }
- public void SetHitColor(Med Med)
- {
- foreach (Par item in pars.EnumAllPar())
- {
- if (item.HitColor != Color.Transparent)
- {
- Med.RemUniqueColor(item.HitColor);
- }
- item.HitColor = Med.GetUniqueColor();
- }
- }
+ public void SetHitColor(Med Med)
+ {
+ foreach (Par item in pars.EnumAllPar())
+ {
+ if (item.HitColor != Color.Transparent)
+ {
+ Med.RemUniqueColor(item.HitColor);
+ }
+ item.HitColor = Med.GetUniqueColor();
+ }
+ }
- public void Dispose()
- {
- pars.Dispose();
- }
+ public void Dispose()
+ {
+ pars.Dispose();
+ }
- public bool IsBut1()
- {
- return this is But1;
- }
+ public bool IsBut1()
+ {
+ return this is But1;
+ }
- public But1 ToBut1()
- {
- return (But1)this;
- }
+ public But1 ToBut1()
+ {
+ return (But1)this;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/But1.cs b/2DGAMELIB/_2DGAMELIB/But1.cs
index 9f3cd5b..e503bbc 100644
--- a/2DGAMELIB/_2DGAMELIB/But1.cs
+++ b/2DGAMELIB/_2DGAMELIB/But1.cs
@@ -3,108 +3,109 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
-namespace _2DGAMELIB;
-
-public class But1 : But
+namespace _2DGAMELIB
{
- public List BaseColors = new List();
+ public class But1 : But
+ {
+ public List BaseColors = new List();
- public List OverColors = new List();
+ public List OverColors = new List();
- public List PushColors = new List();
+ public List PushColors = new List();
- public List TextColors = new List();
+ public List TextColors = new List();
- public But1(Par Par, Action Action)
- : base(Par, Action)
- {
- Setting();
- }
+ public But1(Par Par, Action Action)
+ : base(Par, Action)
+ {
+ Setting();
+ }
- public But1(ParT ParT, Action Action)
- : base(ParT, Action)
- {
- Setting();
- }
+ public But1(ParT ParT, Action Action)
+ : base(ParT, Action)
+ {
+ Setting();
+ }
- public But1(Pars Pars, Action Action)
- : base(Pars, Action)
- {
- Setting();
- }
+ public But1(Pars Pars, Action Action)
+ : base(Pars, Action)
+ {
+ Setting();
+ }
- private void Setting()
- {
- foreach (Par item in pars.EnumAllPar())
- {
- BaseColors.Add(item.BrushColor);
- OverColors.Add(BaseColors.Last().FuncHSV(delegate(Hsv hsv)
- {
- hsv.Hue += 30;
- hsv.Sat -= 30;
- hsv.Val += 100;
- return hsv;
- }));
- PushColors.Add(OverColors.Last().FuncHSV(delegate(Hsv hsv)
- {
- hsv.Hue += 30;
- hsv.Sat -= 30;
- hsv.Val += 100;
- return hsv;
- }));
- TextColors.Add(item.IsParT() ? item.ToParT().TextColor : Color.Empty);
- }
- Over = delegate
- {
- int num4 = 0;
- foreach (Par item2 in pars.EnumAllPar())
- {
- item2.BrushColor = OverColors[num4];
- if (item2.IsParT())
- {
- item2.ToParT().TextColor = TextColors[num4].Reverse();
- }
- num4++;
- }
- };
- Push = delegate
- {
- int num3 = 0;
- foreach (Par item3 in pars.EnumAllPar())
- {
- item3.BrushColor = PushColors[num3];
- if (item3.IsParT())
- {
- item3.ToParT().TextColor = TextColors[num3].Reverse();
- }
- num3++;
- }
- };
- Release = delegate
- {
- int num2 = 0;
- foreach (Par item4 in pars.EnumAllPar())
- {
- item4.BrushColor = OverColors[num2];
- if (item4.IsParT())
- {
- item4.ToParT().TextColor = TextColors[num2].Reverse();
- }
- num2++;
- }
- };
- Out = delegate
- {
- int num = 0;
- foreach (Par item5 in pars.EnumAllPar())
- {
- item5.BrushColor = BaseColors[num];
- if (item5.IsParT())
- {
- item5.ToParT().TextColor = TextColors[num];
- }
- num++;
- }
- };
- }
+ private void Setting()
+ {
+ foreach (Par item in pars.EnumAllPar())
+ {
+ BaseColors.Add(item.BrushColor);
+ OverColors.Add(BaseColors.Last().FuncHSV(delegate(Hsv hsv)
+ {
+ hsv.Hue += 30;
+ hsv.Sat -= 30;
+ hsv.Val += 100;
+ return hsv;
+ }));
+ PushColors.Add(OverColors.Last().FuncHSV(delegate(Hsv hsv)
+ {
+ hsv.Hue += 30;
+ hsv.Sat -= 30;
+ hsv.Val += 100;
+ return hsv;
+ }));
+ TextColors.Add(item.IsParT() ? item.ToParT().TextColor : Color.Empty);
+ }
+ Over = delegate
+ {
+ int num4 = 0;
+ foreach (Par item2 in pars.EnumAllPar())
+ {
+ item2.BrushColor = OverColors[num4];
+ if (item2.IsParT())
+ {
+ item2.ToParT().TextColor = TextColors[num4].Reverse();
+ }
+ num4++;
+ }
+ };
+ Push = delegate
+ {
+ int num3 = 0;
+ foreach (Par item3 in pars.EnumAllPar())
+ {
+ item3.BrushColor = PushColors[num3];
+ if (item3.IsParT())
+ {
+ item3.ToParT().TextColor = TextColors[num3].Reverse();
+ }
+ num3++;
+ }
+ };
+ Release = delegate
+ {
+ int num2 = 0;
+ foreach (Par item4 in pars.EnumAllPar())
+ {
+ item4.BrushColor = OverColors[num2];
+ if (item4.IsParT())
+ {
+ item4.ToParT().TextColor = TextColors[num2].Reverse();
+ }
+ num2++;
+ }
+ };
+ Out = delegate
+ {
+ int num = 0;
+ foreach (Par item5 in pars.EnumAllPar())
+ {
+ item5.BrushColor = BaseColors[num];
+ if (item5.IsParT())
+ {
+ item5.ToParT().TextColor = TextColors[num];
+ }
+ num++;
+ }
+ };
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Buts.cs b/2DGAMELIB/_2DGAMELIB/Buts.cs
index e180c2d..d69f12b 100644
--- a/2DGAMELIB/_2DGAMELIB/Buts.cs
+++ b/2DGAMELIB/_2DGAMELIB/Buts.cs
@@ -2,87 +2,88 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
-namespace _2DGAMELIB;
-
-public class Buts
+namespace _2DGAMELIB
{
- private OrderedDictionary buts = new OrderedDictionary();
+ public class Buts
+ {
+ private OrderedDictionary buts = new OrderedDictionary();
- public But this[string Name] => buts[Name];
+ public But this[string Name] => buts[Name];
- public IEnumerable EnumBut => buts.Values;
+ public IEnumerable EnumBut => buts.Values;
- public void Add(string Name, But But)
- {
- buts.Add(Name, But);
- }
+ public void Add(string Name, But But)
+ {
+ buts.Add(Name, But);
+ }
- public void Down(ref Color HitColor)
- {
- using IEnumerator enumerator = buts.Values.GetEnumerator();
- while (enumerator.MoveNext() && !enumerator.Current.Down(ref HitColor))
- {
- }
- }
+ public void Down(ref Color HitColor)
+ {
+ using IEnumerator enumerator = buts.Values.GetEnumerator();
+ while (enumerator.MoveNext() && !enumerator.Current.Down(ref HitColor))
+ {
+ }
+ }
- public void Up(ref Color HitColor)
- {
- using IEnumerator enumerator = buts.Values.GetEnumerator();
- while (enumerator.MoveNext() && !enumerator.Current.Up(ref HitColor))
- {
- }
- }
+ public void Up(ref Color HitColor)
+ {
+ using IEnumerator enumerator = buts.Values.GetEnumerator();
+ while (enumerator.MoveNext() && !enumerator.Current.Up(ref HitColor))
+ {
+ }
+ }
- public void Move(ref Color HitColor)
- {
- foreach (But value in buts.Values)
- {
- value.Move(ref HitColor);
- }
- }
+ public void Move(ref Color HitColor)
+ {
+ foreach (But value in buts.Values)
+ {
+ value.Move(ref HitColor);
+ }
+ }
- public void Leave()
- {
- using IEnumerator enumerator = buts.Values.GetEnumerator();
- while (enumerator.MoveNext() && !enumerator.Current.Leave())
- {
- }
- }
+ public void Leave()
+ {
+ using IEnumerator enumerator = buts.Values.GetEnumerator();
+ while (enumerator.MoveNext() && !enumerator.Current.Leave())
+ {
+ }
+ }
- public void SetHitColor(Med Med)
- {
- foreach (But item in EnumBut)
- {
- item.SetHitColor(Med);
- }
- }
+ public void SetHitColor(Med Med)
+ {
+ foreach (But item in EnumBut)
+ {
+ item.SetHitColor(Med);
+ }
+ }
- public void Draw(Are Are)
- {
- foreach (But value in buts.Values)
- {
- value.Draw(Are);
- }
- }
+ public void Draw(Are Are)
+ {
+ foreach (But value in buts.Values)
+ {
+ value.Draw(Are);
+ }
+ }
- public void Draw(AreM AreM)
- {
- foreach (But value in buts.Values)
- {
- value.Draw(AreM);
- }
- }
+ public void Draw(AreM AreM)
+ {
+ foreach (But value in buts.Values)
+ {
+ value.Draw(AreM);
+ }
+ }
- public void Dispose()
- {
- foreach (But value in buts.Values)
- {
- value.Dispose();
- }
- }
+ public void Dispose()
+ {
+ foreach (But value in buts.Values)
+ {
+ value.Dispose();
+ }
+ }
- public bool IsHit(Color hc)
- {
- return EnumBut.Any((But e) => e.Pars.Values.First().ToPar().HitColor == hc);
- }
+ public bool IsHit(Color hc)
+ {
+ return EnumBut.Any((But e) => e.Pars.Values.First().ToPar().HitColor == hc);
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/ConstProp.cs b/2DGAMELIB/_2DGAMELIB/ConstProp.cs
index 417be86..14779e8 100644
--- a/2DGAMELIB/_2DGAMELIB/ConstProp.cs
+++ b/2DGAMELIB/_2DGAMELIB/ConstProp.cs
@@ -1,17 +1,18 @@
-namespace _2DGAMELIB;
-
-public class ConstProp
+namespace _2DGAMELIB
{
- private int c = -1;
+ public class ConstProp
+ {
+ private int c = -1;
- public bool GetFlag(double Proportion)
- {
- c++;
- return c % (int)(1.0 / Proportion) == 0;
- }
+ public bool GetFlag(double Proportion)
+ {
+ c++;
+ return c % (int)(1.0 / Proportion) == 0;
+ }
- public void Reset()
- {
- c = -1;
- }
+ public void Reset()
+ {
+ c = -1;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Dat.cs b/2DGAMELIB/_2DGAMELIB/Dat.cs
index c52c1d8..b46fcd9 100644
--- a/2DGAMELIB/_2DGAMELIB/Dat.cs
+++ b/2DGAMELIB/_2DGAMELIB/Dat.cs
@@ -1,19 +1,20 @@
using System.Runtime.InteropServices;
-namespace _2DGAMELIB;
-
-[StructLayout(LayoutKind.Sequential, Size = 1)]
-public struct Dat
+namespace _2DGAMELIB
{
- public static MatrixD MatDZero = new MatrixD(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ [StructLayout(LayoutKind.Sequential, Size = 1)]
+ public struct Dat
+ {
+ public static MatrixD MatDZero = new MatrixD(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
- public static MatrixD MatDIdentity = new MatrixD(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
+ public static MatrixD MatDIdentity = new MatrixD(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
- public static Vector2D Vec2DZero = new Vector2D(0.0, 0.0);
+ public static Vector2D Vec2DZero = new Vector2D(0.0, 0.0);
- public static Vector2D Vec2DOne = new Vector2D(1.0, 1.0);
+ public static Vector2D Vec2DOne = new Vector2D(1.0, 1.0);
- public static Vector2D Vec2DUnitX = new Vector2D(1.0, 0.0);
+ public static Vector2D Vec2DUnitX = new Vector2D(1.0, 0.0);
- public static Vector2D Vec2DUnitY = new Vector2D(0.0, 1.0);
+ public static Vector2D Vec2DUnitY = new Vector2D(0.0, 1.0);
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Dif.cs b/2DGAMELIB/_2DGAMELIB/Dif.cs
index a1d5fa7..67b5cf9 100644
--- a/2DGAMELIB/_2DGAMELIB/Dif.cs
+++ b/2DGAMELIB/_2DGAMELIB/Dif.cs
@@ -2,289 +2,290 @@ using System;
using System.Collections.Generic;
using System.Drawing;
-namespace _2DGAMELIB;
-
-[Serializable]
-public class Dif
+namespace _2DGAMELIB
{
- public string Tag = "";
+ [Serializable]
+ public class Dif
+ {
+ public string Tag = "";
- private List parss = new List();
+ private List parss = new List();
- public List Parss => parss;
+ public List Parss => parss;
- public int Count => parss.Count;
+ public int Count => parss.Count;
- public Pars this[int Index]
- {
- get
- {
- return parss[Index];
- }
- set
- {
- parss[Index] = value;
- }
- }
+ public Pars this[int Index]
+ {
+ get
+ {
+ return parss[Index];
+ }
+ set
+ {
+ parss[Index] = value;
+ }
+ }
- public double PositionSize
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.PositionSize = value;
- }
- }
- }
+ public double PositionSize
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.PositionSize = value;
+ }
+ }
+ }
- public Vector2D PositionVector
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.PositionVector = value;
- }
- }
- }
+ public Vector2D PositionVector
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.PositionVector = value;
+ }
+ }
+ }
- public double AngleBase
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.AngleBase = value;
- }
- }
- }
+ public double AngleBase
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.AngleBase = value;
+ }
+ }
+ }
- public double AngleCont
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.AngleCont = value;
- }
- }
- }
+ public double AngleCont
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.AngleCont = value;
+ }
+ }
+ }
- public double SizeBase
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.SizeBase = value;
- }
- }
- }
+ public double SizeBase
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.SizeBase = value;
+ }
+ }
+ }
- public double SizeCont
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.SizeCont = value;
- }
- }
- }
+ public double SizeCont
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.SizeCont = value;
+ }
+ }
+ }
- public double SizeXBase
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.SizeXBase = value;
- }
- }
- }
+ public double SizeXBase
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.SizeXBase = value;
+ }
+ }
+ }
- public double SizeXCont
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.SizeXCont = value;
- }
- }
- }
+ public double SizeXCont
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.SizeXCont = value;
+ }
+ }
+ }
- public double SizeYBase
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.SizeYBase = value;
- }
- }
- }
+ public double SizeYBase
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.SizeYBase = value;
+ }
+ }
+ }
- public double SizeYCont
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.SizeYCont = value;
- }
- }
- }
+ public double SizeYCont
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.SizeYCont = value;
+ }
+ }
+ }
- public bool Dra
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.Dra = value;
- }
- }
- }
+ public bool Dra
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.Dra = value;
+ }
+ }
+ }
- public bool Hit
- {
- set
- {
- foreach (Pars item in parss)
- {
- item.Hit = value;
- }
- }
- }
+ public bool Hit
+ {
+ set
+ {
+ foreach (Pars item in parss)
+ {
+ item.Hit = value;
+ }
+ }
+ }
- public IEnumerable EnumAllPar()
- {
- foreach (Pars item in parss)
- {
- foreach (Par item2 in item.EnumAllPar())
- {
- yield return item2;
- }
- }
- }
+ public IEnumerable EnumAllPar()
+ {
+ foreach (Pars item in parss)
+ {
+ foreach (Par item2 in item.EnumAllPar())
+ {
+ yield return item2;
+ }
+ }
+ }
- public void SetDefault()
- {
- foreach (Pars item in parss)
- {
- item.SetDefault();
- }
- }
+ public void SetDefault()
+ {
+ foreach (Pars item in parss)
+ {
+ item.SetDefault();
+ }
+ }
- public Dif()
- {
- }
+ public Dif()
+ {
+ }
- public Dif(Dif Dif)
- {
- Copy(Dif);
- }
+ public Dif(Dif Dif)
+ {
+ Copy(Dif);
+ }
- private void Copy(Dif Dif)
- {
- Tag = Dif.Tag;
- foreach (Pars item in Dif.parss)
- {
- parss.Add(new Pars(item));
- }
- }
+ private void Copy(Dif Dif)
+ {
+ Tag = Dif.Tag;
+ foreach (Pars item in Dif.parss)
+ {
+ parss.Add(new Pars(item));
+ }
+ }
- public void Add(Pars Pars)
- {
- parss.Add(Pars);
- }
+ public void Add(Pars Pars)
+ {
+ parss.Add(Pars);
+ }
- public void Insert(int Index, Pars Pars)
- {
- parss.Insert(Index, Pars);
- }
+ public void Insert(int Index, Pars Pars)
+ {
+ parss.Insert(Index, Pars);
+ }
- public void Remove(Pars Pars)
- {
- parss.Remove(Pars);
- }
+ public void Remove(Pars Pars)
+ {
+ parss.Remove(Pars);
+ }
- public void RemoveAt(int Index)
- {
- parss.RemoveAt(Index);
- }
+ public void RemoveAt(int Index)
+ {
+ parss.RemoveAt(Index);
+ }
- public void Draws(Are Are)
- {
- foreach (Pars item in parss)
- {
- Are.Draw(item);
- }
- }
+ public void Draws(Are Are)
+ {
+ foreach (Pars item in parss)
+ {
+ Are.Draw(item);
+ }
+ }
- public void Draws(AreM AreM)
- {
- foreach (Pars item in parss)
- {
- AreM.Draw(item);
- }
- }
+ public void Draws(AreM AreM)
+ {
+ foreach (Pars item in parss)
+ {
+ AreM.Draw(item);
+ }
+ }
- public List GetHitTags(ref Color HitColor)
- {
- List list = new List();
- foreach (Pars item in parss)
- {
- list.AddRange(item.GetHitTags(ref HitColor));
- }
- return list;
- }
+ public List GetHitTags(ref Color HitColor)
+ {
+ List list = new List();
+ foreach (Pars item in parss)
+ {
+ list.AddRange(item.GetHitTags(ref HitColor));
+ }
+ return list;
+ }
- public List GetHitPars(ref Color HitColor)
- {
- List list = new List();
- foreach (Pars item in parss)
- {
- list.AddRange(item.GetHitPars(ref HitColor));
- }
- return list;
- }
+ public List GetHitPars(ref Color HitColor)
+ {
+ List list = new List();
+ foreach (Pars item in parss)
+ {
+ list.AddRange(item.GetHitPars(ref HitColor));
+ }
+ return list;
+ }
- public bool IsHit(ref Color HitColor)
- {
- foreach (Pars item in parss)
- {
- if (item.IsHit(ref HitColor))
- {
- return true;
- }
- }
- return false;
- }
+ public bool IsHit(ref Color HitColor)
+ {
+ foreach (Pars item in parss)
+ {
+ if (item.IsHit(ref HitColor))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
- public void ReverseX()
- {
- foreach (Pars item in parss)
- {
- item.ReverseX();
- }
- }
+ public void ReverseX()
+ {
+ foreach (Pars item in parss)
+ {
+ item.ReverseX();
+ }
+ }
- public void ReverseY()
- {
- foreach (Pars item in parss)
- {
- item.ReverseY();
- }
- }
+ public void ReverseY()
+ {
+ foreach (Pars item in parss)
+ {
+ item.ReverseY();
+ }
+ }
- public void Dispose()
- {
- foreach (Pars item in parss)
- {
- item.Dispose();
- }
- }
+ public void Dispose()
+ {
+ foreach (Pars item in parss)
+ {
+ item.Dispose();
+ }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Difs.cs b/2DGAMELIB/_2DGAMELIB/Difs.cs
index 6320d77..0dcb01a 100644
--- a/2DGAMELIB/_2DGAMELIB/Difs.cs
+++ b/2DGAMELIB/_2DGAMELIB/Difs.cs
@@ -4,471 +4,472 @@ using System.Drawing;
using System.Linq;
using Newtonsoft.Json;
-namespace _2DGAMELIB;
-
-[Serializable]
-public class Difs
+namespace _2DGAMELIB
{
- public string Tag = "";
+ [Serializable]
+ public class Difs
+ {
+ public string Tag = "";
- public double ValueX;
+ public double ValueX;
- public double ValueY;
+ public double ValueY;
- private List difs = new List();
+ private List difs = new List();
- public Dictionary pj;
+ public Dictionary pj;
- public Dictionary pr;
+ public Dictionary pr;
- public List Difss => difs;
+ public List Difss => difs;
- public int CountX => difs.Count;
+ public int CountX => difs.Count;
- public int CountY
- {
- get
- {
- if (difs.Count > 0)
- {
- return difs[IndexX].Count;
- }
- return 0;
- }
- }
+ public int CountY
+ {
+ get
+ {
+ if (difs.Count > 0)
+ {
+ return difs[IndexX].Count;
+ }
+ return 0;
+ }
+ }
- public int IndexX
- {
- get
- {
- if (!(ValueX >= 1.0))
- {
- return (int)((double)CountX * ValueX);
- }
- return CountX - 1;
- }
- set
- {
- ValueX = (double)value / (double)CountX;
- }
- }
+ public int IndexX
+ {
+ get
+ {
+ if (!(ValueX >= 1.0))
+ {
+ return (int)((double)CountX * ValueX);
+ }
+ return CountX - 1;
+ }
+ set
+ {
+ ValueX = (double)value / (double)CountX;
+ }
+ }
- public int IndexY
- {
- get
- {
- if (!(ValueY >= 1.0))
- {
- return (int)((double)CountY * ValueY);
- }
- return CountY - 1;
- }
- set
- {
- ValueY = (double)value / (double)CountY;
- }
- }
+ public int IndexY
+ {
+ get
+ {
+ if (!(ValueY >= 1.0))
+ {
+ return (int)((double)CountY * ValueY);
+ }
+ return CountY - 1;
+ }
+ set
+ {
+ ValueY = (double)value / (double)CountY;
+ }
+ }
- public Dif this[int Index]
- {
- get
- {
- return difs[Index];
- }
- set
- {
- difs[Index] = value;
- }
- }
+ public Dif this[int Index]
+ {
+ get
+ {
+ return difs[Index];
+ }
+ set
+ {
+ difs[Index] = value;
+ }
+ }
- public Pars Current => difs[IndexX][IndexY];
+ public Pars Current => difs[IndexX][IndexY];
- public double PositionSize
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.PositionSize = value;
- }
- }
- }
+ public double PositionSize
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.PositionSize = value;
+ }
+ }
+ }
- public Vector2D PositionVector
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.PositionVector = value;
- }
- }
- }
+ public Vector2D PositionVector
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.PositionVector = value;
+ }
+ }
+ }
- public double AngleBase
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.AngleBase = value;
- }
- }
- }
+ public double AngleBase
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.AngleBase = value;
+ }
+ }
+ }
- public double AngleCont
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.AngleCont = value;
- }
- }
- }
+ public double AngleCont
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.AngleCont = value;
+ }
+ }
+ }
- public double SizeBase
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.SizeBase = value;
- }
- }
- }
+ public double SizeBase
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.SizeBase = value;
+ }
+ }
+ }
- public double SizeCont
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.SizeCont = value;
- }
- }
- }
+ public double SizeCont
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.SizeCont = value;
+ }
+ }
+ }
- public double SizeXBase
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.SizeXBase = value;
- }
- }
- }
+ public double SizeXBase
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.SizeXBase = value;
+ }
+ }
+ }
- public double SizeXCont
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.SizeXCont = value;
- }
- }
- }
+ public double SizeXCont
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.SizeXCont = value;
+ }
+ }
+ }
- public double SizeYBase
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.SizeYBase = value;
- }
- }
- }
+ public double SizeYBase
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.SizeYBase = value;
+ }
+ }
+ }
- public double SizeYCont
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.SizeYCont = value;
- }
- }
- }
+ public double SizeYCont
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.SizeYCont = value;
+ }
+ }
+ }
- public bool Dra
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.Dra = value;
- }
- }
- }
+ public bool Dra
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.Dra = value;
+ }
+ }
+ }
- public bool Hit
- {
- set
- {
- foreach (Dif dif in difs)
- {
- dif.Hit = value;
- }
- }
- }
+ public bool Hit
+ {
+ set
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.Hit = value;
+ }
+ }
+ }
- [JsonIgnore]
- public Par CurJoinRoot
- {
- get
- {
- Pars current = Current;
- if (pr.ContainsKey(current))
- {
- return pr[current];
- }
- return null;
- }
- }
+ [JsonIgnore]
+ public Par CurJoinRoot
+ {
+ get
+ {
+ Pars current = Current;
+ if (pr.ContainsKey(current))
+ {
+ return pr[current];
+ }
+ return null;
+ }
+ }
- [JsonIgnore]
- public IEnumerable EnumJoinRoot => pr.Values;
- public IEnumerable EnumAllPar()
- {
- foreach (Dif dif in difs)
- {
- foreach (Par item in dif.EnumAllPar())
- {
- yield return item;
- }
- }
- }
+ [JsonIgnore]
+ public IEnumerable EnumJoinRoot => pr.Values;
+ public IEnumerable EnumAllPar()
+ {
+ foreach (Dif dif in difs)
+ {
+ foreach (Par item in dif.EnumAllPar())
+ {
+ yield return item;
+ }
+ }
+ }
- public IEnumerable EnumAllPars()
- {
- foreach (Dif dif in difs)
- {
- foreach (Pars item in dif.Parss)
- {
- yield return item;
- }
- }
- }
+ public IEnumerable EnumAllPars()
+ {
+ foreach (Dif dif in difs)
+ {
+ foreach (Pars item in dif.Parss)
+ {
+ yield return item;
+ }
+ }
+ }
- public void SetDefault()
- {
- foreach (Dif dif in difs)
- {
- dif.SetDefault();
- }
- }
+ public void SetDefault()
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.SetDefault();
+ }
+ }
- public Difs()
- {
- }
+ public Difs()
+ {
+ }
- public Difs(Difs Difs)
- {
- Copy(Difs);
- }
+ public Difs(Difs Difs)
+ {
+ Copy(Difs);
+ }
- private void Copy(Difs Difs)
- {
- Tag = Difs.Tag;
- ValueX = Difs.ValueX;
- ValueY = Difs.ValueY;
- foreach (Dif dif in Difs.difs)
- {
- difs.Add(new Dif(dif));
- }
- }
+ private void Copy(Difs Difs)
+ {
+ Tag = Difs.Tag;
+ ValueX = Difs.ValueX;
+ ValueY = Difs.ValueY;
+ foreach (Dif dif in Difs.difs)
+ {
+ difs.Add(new Dif(dif));
+ }
+ }
- public void Add(Dif Dif)
- {
- difs.Add(Dif);
- }
+ public void Add(Dif Dif)
+ {
+ difs.Add(Dif);
+ }
- public void Insert(int Index, Dif Dif)
- {
- difs.Insert(Index, Dif);
- }
+ public void Insert(int Index, Dif Dif)
+ {
+ difs.Insert(Index, Dif);
+ }
- public void Remove(Dif Dif)
- {
- difs.Remove(Dif);
- }
+ public void Remove(Dif Dif)
+ {
+ difs.Remove(Dif);
+ }
- public void RemoveAt(int Index)
- {
- difs.RemoveAt(Index);
- }
+ public void RemoveAt(int Index)
+ {
+ difs.RemoveAt(Index);
+ }
- public void Draw(Are Are)
- {
- Are.Draw(Current);
- }
+ public void Draw(Are Are)
+ {
+ Are.Draw(Current);
+ }
- public void Draws(Are Are)
- {
- foreach (Dif dif in difs)
- {
- dif.Draws(Are);
- }
- }
+ public void Draws(Are Are)
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.Draws(Are);
+ }
+ }
- public void Draw(AreM AreM)
- {
- AreM.Draw(Current);
- }
+ public void Draw(AreM AreM)
+ {
+ AreM.Draw(Current);
+ }
- public void Draws(AreM AreM)
- {
- foreach (Dif dif in difs)
- {
- dif.Draws(AreM);
- }
- }
- private Par GetJoinRoot(Pars ps)
- {
- Par[] array = ps.EnumAllPar().ToArray();
- if (array.Length <= 1)
- {
- return array.FirstOrDefault();
- }
- Par[] array2 = array;
- foreach (Par p0 in array2)
- {
- Vector2D p = p0.Position;
- if (array.All((Par p1) => p0 == p1 || p1.JP.All((Joi j) => !(p1.ToGlobal(j.Joint).DistanceSquared(p) <= Join.IdentityDistance))))
- {
- return p0;
- }
- }
- Par par = array.FirstOrDefault((Par e) => e.JP.Count > 0);
- if (par != null)
- {
- return par;
- }
- return array.First();
- }
+ public void Draws(AreM AreM)
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.Draws(AreM);
+ }
+ }
+ private Par GetJoinRoot(Pars ps)
+ {
+ Par[] array = ps.EnumAllPar().ToArray();
+ if (array.Length <= 1)
+ {
+ return array.FirstOrDefault();
+ }
+ Par[] array2 = array;
+ foreach (Par p0 in array2)
+ {
+ Vector2D p = p0.Position;
+ if (array.All((Par p1) => p0 == p1 || p1.JP.All((Joi j) => !(p1.ToGlobal(j.Joint).DistanceSquared(p) <= Join.IdentityDistance))))
+ {
+ return p0;
+ }
+ }
+ Par par = array.FirstOrDefault((Par e) => e.JP.Count > 0);
+ if (par != null)
+ {
+ return par;
+ }
+ return array.First();
+ }
- public void SetJoints()
- {
- pj = new Dictionary();
- pr = new Dictionary();
- foreach (Pars item in EnumAllPars())
- {
- Par joinRoot = GetJoinRoot(item);
- if (joinRoot != null)
- {
- pj.Add(item, joinRoot.GetJoints(item.EnumAllPar()));
- pr.Add(item, joinRoot);
- }
- }
- }
+ public void SetJoints()
+ {
+ pj = new Dictionary();
+ pr = new Dictionary();
+ foreach (Pars item in EnumAllPars())
+ {
+ Par joinRoot = GetJoinRoot(item);
+ if (joinRoot != null)
+ {
+ pj.Add(item, joinRoot.GetJoints(item.EnumAllPar()));
+ pr.Add(item, joinRoot);
+ }
+ }
+ }
- public void JoinP()
- {
- pj[Current].JoinP();
- }
+ public void JoinP()
+ {
+ pj[Current].JoinP();
+ }
- public void JoinPA()
- {
- pj[Current].JoinPA();
- }
+ public void JoinPA()
+ {
+ pj[Current].JoinPA();
+ }
- public void JoinPall()
- {
- foreach (Joints value in pj.Values)
- {
- value.JoinP();
- }
- }
+ public void JoinPall()
+ {
+ foreach (Joints value in pj.Values)
+ {
+ value.JoinP();
+ }
+ }
- public void JoinPAall()
- {
- foreach (Joints value in pj.Values)
- {
- value.JoinPA();
- }
- }
+ public void JoinPAall()
+ {
+ foreach (Joints value in pj.Values)
+ {
+ value.JoinPA();
+ }
+ }
- public void JoinP(Pars ps)
- {
- if (pj.ContainsKey(ps))
- {
- pj[ps].JoinP();
- }
- }
+ public void JoinP(Pars ps)
+ {
+ if (pj.ContainsKey(ps))
+ {
+ pj[ps].JoinP();
+ }
+ }
- public void JoinPA(Pars ps)
- {
- if (pj.ContainsKey(ps))
- {
- pj[ps].JoinPA();
- }
- }
+ public void JoinPA(Pars ps)
+ {
+ if (pj.ContainsKey(ps))
+ {
+ pj[ps].JoinPA();
+ }
+ }
- public Par GetHitPar_(Color HitColor)
- {
- return difs.FirstOrDefault((Dif d) => d.IsHit(ref HitColor)).Parss.FirstOrDefault((Pars ps) => ps.IsHit(ref HitColor)).EnumAllPar().FirstOrDefault((Par e) => e.HitColor == HitColor);
- }
+ public Par GetHitPar_(Color HitColor)
+ {
+ return difs.FirstOrDefault((Dif d) => d.IsHit(ref HitColor)).Parss.FirstOrDefault((Pars ps) => ps.IsHit(ref HitColor)).EnumAllPar().FirstOrDefault((Par e) => e.HitColor == HitColor);
+ }
- public List GetHitTags(ref Color HitColor)
- {
- List list = new List();
- foreach (Dif dif in difs)
- {
- list.AddRange(dif.GetHitTags(ref HitColor));
- }
- return list;
- }
+ public List GetHitTags(ref Color HitColor)
+ {
+ List list = new List();
+ foreach (Dif dif in difs)
+ {
+ list.AddRange(dif.GetHitTags(ref HitColor));
+ }
+ return list;
+ }
- public List GetHitPars(ref Color HitColor)
- {
- List list = new List();
- foreach (Dif dif in difs)
- {
- list.AddRange(dif.GetHitPars(ref HitColor));
- }
- return list;
- }
+ public List GetHitPars(ref Color HitColor)
+ {
+ List list = new List();
+ foreach (Dif dif in difs)
+ {
+ list.AddRange(dif.GetHitPars(ref HitColor));
+ }
+ return list;
+ }
- public bool IsHit(ref Color HitColor)
- {
- foreach (Dif dif in difs)
- {
- if (dif.IsHit(ref HitColor))
- {
- return true;
- }
- }
- return false;
- }
+ public bool IsHit(ref Color HitColor)
+ {
+ foreach (Dif dif in difs)
+ {
+ if (dif.IsHit(ref HitColor))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
- public void ReverseX()
- {
- SetJoints();
- foreach (Dif dif in difs)
- {
- dif.ReverseX();
- }
- JoinP();
- }
+ public void ReverseX()
+ {
+ SetJoints();
+ foreach (Dif dif in difs)
+ {
+ dif.ReverseX();
+ }
+ JoinP();
+ }
- public void ReverseY()
- {
- SetJoints();
- foreach (Dif dif in difs)
- {
- dif.ReverseY();
- }
- JoinP();
- }
+ public void ReverseY()
+ {
+ SetJoints();
+ foreach (Dif dif in difs)
+ {
+ dif.ReverseY();
+ }
+ JoinP();
+ }
- public void Dispose()
- {
- foreach (Dif dif in difs)
- {
- dif.Dispose();
- }
- }
+ public void Dispose()
+ {
+ foreach (Dif dif in difs)
+ {
+ dif.Dispose();
+ }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/FPS.cs b/2DGAMELIB/_2DGAMELIB/FPS.cs
index 69d68c2..959da7b 100644
--- a/2DGAMELIB/_2DGAMELIB/FPS.cs
+++ b/2DGAMELIB/_2DGAMELIB/FPS.cs
@@ -1,38 +1,39 @@
using System;
using System.Diagnostics;
-namespace _2DGAMELIB;
-
-public class FPS
+namespace _2DGAMELIB
{
- public Stopwatch sw = new Stopwatch();
+ public class FPS
+ {
+ public Stopwatch sw = new Stopwatch();
- private long last_frame;
- public double Value;
+ private long last_frame;
+ public double Value;
- private int count;
+ private int count;
- private double ticks_per_frame;
- public FPS(double FPS)
- {
- Value = FPS;
- ticks_per_frame = (double)Stopwatch.Frequency / FPS;
- sw.Start();
- last_frame = sw.ElapsedTicks;
- }
+ private double ticks_per_frame;
+ public FPS(double FPS)
+ {
+ Value = FPS;
+ ticks_per_frame = (double)Stopwatch.Frequency / FPS;
+ sw.Start();
+ last_frame = sw.ElapsedTicks;
+ }
- public void FPSFixed(Action Action)
- {
- long current_time = sw.ElapsedTicks;
+ public void FPSFixed(Action Action)
+ {
+ long current_time = sw.ElapsedTicks;
- if (current_time - last_frame >= ticks_per_frame)
- {
- Action();
+ if (current_time - last_frame >= ticks_per_frame)
+ {
+ Action();
- Value = (9 * Value + ((double)Stopwatch.Frequency / (sw.ElapsedTicks - last_frame)))/10;
+ Value = (9 * Value + ((double)Stopwatch.Frequency / (sw.ElapsedTicks - last_frame)))/10;
- last_frame = current_time;
- }
+ last_frame = current_time;
+ }
- }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Gau.cs b/2DGAMELIB/_2DGAMELIB/Gau.cs
index dfa127e..b8e4ee4 100644
--- a/2DGAMELIB/_2DGAMELIB/Gau.cs
+++ b/2DGAMELIB/_2DGAMELIB/Gau.cs
@@ -1,628 +1,629 @@
using System.Drawing;
-namespace _2DGAMELIB;
-
-public enum Range
+namespace _2DGAMELIB
{
- ZeroOne = 1,
- MinusPlus
-}
+ public enum Range
+ {
+ ZeroOne = 1,
+ MinusPlus
+ }
-public enum Open
-{
- Top = 1,
- Bot,
- Lef,
- Rig
-}
+ public enum Open
+ {
+ Top = 1,
+ Bot,
+ Lef,
+ Rig
+ }
-public class Gau
-{
- private Pars pars;
+ public class Gau
+ {
+ private Pars pars;
- private Par base_;
+ private Par base_;
- private Par frame1;
+ private Par frame1;
- private Par frame2;
+ private Par frame2;
- private Par gauge;
+ private Par gauge;
- private Par knob;
+ private Par knob;
- private double val;
+ private double val;
- private Brush PlusBrush;
+ private Brush PlusBrush;
- private Brush MinusBrush;
+ private Brush MinusBrush;
- private Open Open;
+ private Open Open;
- private Range Range;
+ private Range Range;
- private double Max;
+ private double Max;
- private bool Grip;
+ private bool Grip;
- private Vector2D op;
+ private Vector2D op;
- private double Unit;
+ private double Unit;
- private Color PlusColor1;
+ private Color PlusColor1;
- private Color PlusColor2;
+ private Color PlusColor2;
- private Color MinusColor1;
+ private Color MinusColor1;
- private Color MinusColor2;
+ private Color MinusColor2;
- public Pars Pars => pars;
+ public Pars Pars => pars;
- public Par Base => base_;
+ public Par Base => base_;
- public Par Frame1 => frame1;
+ public Par Frame1 => frame1;
- public Par Frame2 => frame2;
+ public Par Frame2 => frame2;
- public Par Gauge => gauge;
+ public Par Gauge => gauge;
- public Par Knob => knob;
+ public Par Knob => knob;
- public double Value
- {
- get
- {
- return val;
- }
- set
- {
- val = value;
- SetLimit();
- SetColor();
- SetValue();
- }
- }
+ public double Value
+ {
+ get
+ {
+ return val;
+ }
+ set
+ {
+ val = value;
+ SetLimit();
+ SetColor();
+ SetValue();
+ }
+ }
+
+ private Vector2D TL1 => frame1.OP[0].ps[0];
- private Vector2D TL1 => frame1.OP[0].ps[0];
-
- private Vector2D TR1 => frame1.OP[0].ps[1];
-
- private Vector2D BR1 => frame1.OP[0].ps[2];
-
- private Vector2D BL1 => frame1.OP[0].ps[3];
-
- private Vector2D TL2 => frame2.OP[0].ps[0];
-
- private Vector2D TR2 => frame2.OP[0].ps[1];
-
- private Vector2D BR2 => frame2.OP[0].ps[2];
-
- private Vector2D BL2 => frame2.OP[0].ps[3];
-
- private Vector2D TLG => gauge.OP[0].ps[0];
-
- private Vector2D TRG => gauge.OP[0].ps[1];
-
- private Vector2D BRG => gauge.OP[0].ps[2];
-
- private Vector2D BLG => gauge.OP[0].ps[3];
-
- private void SetLimit()
- {
- if (Range == Range.ZeroOne)
- {
- val = val.Clamp(0.0, 1.0);
- }
- else
- {
- val = val.Clamp(-1.0, 1.0);
- }
- }
-
- private void SetColor()
- {
- if (val > 0.0)
- {
- gauge.SetBrush(PlusBrush);
- }
- else
- {
- gauge.SetBrush(MinusBrush);
- }
- }
-
- private void SetValue()
- {
- if (Open == Open.Top || Open == Open.Bot)
- {
- gauge.SizeYCont = val;
- }
- else if (Open == Open.Lef || Open == Open.Rig)
- {
- gauge.SizeXCont = val;
- }
- if (knob != null)
- {
- knob.PositionBase = GetKnobPosition();
- }
- }
-
- private Vector2D GetBasePoint1()
- {
- if (Range == Range.MinusPlus)
- {
- switch (Open)
- {
- case Open.Top:
- return (BL1 + BR1) * 0.5;
- case Open.Bot:
- return (TL1 + TR1) * 0.5;
- case Open.Rig:
- return (TL1 + BL1) * 0.5;
- case Open.Lef:
- return (TR1 + BR1) * 0.5;
- }
- }
- return frame1.OP.GetCenter();
- }
-
- private Vector2D GetBasePoint2()
- {
- if (Range == Range.MinusPlus)
- {
- switch (Open)
- {
- case Open.Top:
- return (TL2 + TR2) * 0.5;
- case Open.Bot:
- return (BL2 + BR2) * 0.5;
- case Open.Rig:
- return (TR2 + BR2) * 0.5;
- case Open.Lef:
- return (TL2 + BL2) * 0.5;
- }
- }
- return frame2.OP.GetCenter();
- }
-
- private Vector2D GetBasePoint()
- {
- if (Range == Range.ZeroOne)
- {
- switch (Open)
- {
- case Open.Top:
- return (BLG + BRG) * 0.5;
- case Open.Bot:
- return (TLG + TRG) * 0.5;
- case Open.Rig:
- return (TLG + BLG) * 0.5;
- case Open.Lef:
- return (TRG + BRG) * 0.5;
- }
- }
- return frame1.BasePoint;
- }
-
- private double GetWidthMag()
- {
- if (Range == Range.MinusPlus && (Open == Open.Lef || Open == Open.Rig))
- {
- return 0.5;
- }
- return 1.0;
- }
-
- private double GetHeightMag()
- {
- if (Range == Range.MinusPlus && (Open == Open.Top || Open == Open.Bot))
- {
- return 0.5;
- }
- return 1.0;
- }
-
- private double GetGaugeWidthMag(double Margin)
- {
- if (Open == Open.Top || Open == Open.Bot)
- {
- return (Margin * 2.0).Inverse();
- }
- return 1.0;
- }
-
- private double GetGaugeHeightMag(double Margin)
- {
- if (Open == Open.Lef || Open == Open.Rig)
- {
- return (Margin * 2.0).Inverse();
- }
- return 1.0;
- }
-
- private double GetKnobWidthMag(double Width)
- {
- if (Open == Open.Top || Open == Open.Bot)
- {
- return Width;
- }
- return 0.1;
- }
-
- private double GetKnobHeightMag(double Height)
- {
- if (Open == Open.Lef || Open == Open.Rig)
- {
- return Height;
- }
- return 0.1;
- }
-
- private Vector2D GetGaugePosition()
- {
- return Open switch
- {
- Open.Top => frame1.ToGlobal((BL1 + BR1) * 0.5),
- Open.Bot => frame1.ToGlobal((TL1 + TR1) * 0.5),
- Open.Rig => frame1.ToGlobal((TL1 + BL1) * 0.5),
- Open.Lef => frame1.ToGlobal((TR1 + BR1) * 0.5),
- _ => Dat.Vec2DZero,
- };
- }
-
- private Vector2D GetKnobPosition()
- {
- return Open switch
- {
- Open.Top => gauge.ToGlobal((TLG + TRG) * 0.5),
- Open.Bot => gauge.ToGlobal((BLG + BRG) * 0.5),
- Open.Rig => gauge.ToGlobal((TRG + BRG) * 0.5),
- Open.Lef => gauge.ToGlobal((TLG + BLG) * 0.5),
- _ => Dat.Vec2DZero,
- };
- }
-
- private void ParSetting(string Name, ref Vector2D Position, double Size, double Width, double Height, double Margin, ref Color BackColor, bool knob)
- {
- pars = new Pars();
- base_ = new Par
- {
- Tag = Name + "_ベース",
- InitializeOP = new Out[1] { Shas.Get正方形() },
- PositionBase = Position,
- SizeBase = Size,
- SizeXBase = Width,
- SizeYBase = Height,
- Closed = true,
- Pen = null,
- BrushColor = BackColor
- };
- base_.BasePointBase = base_.OP.GetCenter();
- pars.Add(base_.Tag, base_);
- frame1 = new Par
- {
- Tag = Name + "_フレーム1",
- InitializeOP = new Out[1] { Shas.Get正方形() },
- PositionBase = Position,
- SizeBase = Size,
- SizeXBase = Width * GetWidthMag(),
- SizeYBase = Height * GetHeightMag(),
- Closed = true,
- Brush = null
- };
- frame1.BasePointBase = GetBasePoint1();
- pars.Add(frame1.Tag, frame1);
- if (Range == Range.MinusPlus)
- {
- frame2 = new Par
- {
- Tag = Name + "_フレーム2",
- InitializeOP = new Out[1] { Shas.Get正方形() },
- PositionBase = Position,
- SizeBase = Size,
- SizeXBase = Width * GetWidthMag(),
- SizeYBase = Height * GetHeightMag(),
- Closed = true,
- Brush = null
- };
- frame2.BasePointBase = GetBasePoint2();
- pars.Add(frame2.Tag, frame2);
- }
- gauge = new Par
- {
- Tag = Name + "_ゲージ",
- InitializeOP = new Out[1] { Shas.Get正方形() },
- PositionBase = GetGaugePosition(),
- SizeBase = Size,
- SizeXBase = Width * GetWidthMag() * GetGaugeWidthMag(Margin),
- SizeYBase = Height * GetHeightMag() * GetGaugeHeightMag(Margin),
- Closed = true
- };
- gauge.BasePointBase = GetBasePoint();
- pars.Add(gauge.Tag, gauge);
- if (knob)
- {
- this.knob = new Par
- {
- Tag = Name + "_ノブ",
- InitializeOP = new Out[1] { Shas.Get正方形() },
- SizeBase = Size,
- SizeXBase = GetKnobWidthMag(Width),
- SizeYBase = GetKnobHeightMag(Height),
- Closed = true,
- BrushColor = Color.FromArgb(128, Color.White)
- };
- this.knob.BasePointBase = this.knob.OP.GetCenter();
- pars.Add(this.knob.Tag, this.knob);
- }
- }
-
- public void SetHitColor(Med Med)
- {
- if (base_.HitColor != Color.Transparent)
- {
- Med.RemUniqueColor(base_.HitColor);
- }
- base_.HitColor = Med.GetUniqueColor();
- if (frame1.HitColor != Color.Transparent)
- {
- Med.RemUniqueColor(frame1.HitColor);
- }
- frame1.HitColor = Med.GetUniqueColor();
- if (Range == Range.MinusPlus)
- {
- if (frame2.HitColor != Color.Transparent)
- {
- Med.RemUniqueColor(frame2.HitColor);
- }
- frame2.HitColor = Med.GetUniqueColor();
- }
- if (gauge.HitColor != Color.Transparent)
- {
- Med.RemUniqueColor(gauge.HitColor);
- }
- gauge.HitColor = Med.GetUniqueColor();
- if (knob != null)
- {
- if (knob.HitColor != Color.Transparent)
- {
- Med.RemUniqueColor(knob.HitColor);
- }
- knob.HitColor = Med.GetUniqueColor();
- }
- }
-
- private void SetBrush(double Unit, ref Color PlusColor1, ref Color PlusColor2, ref Color MinusColor1, ref Color MinusColor2)
- {
- this.Unit = Unit;
- this.PlusColor1 = PlusColor1;
- this.PlusColor2 = PlusColor2;
- this.MinusColor1 = MinusColor1;
- this.MinusColor2 = MinusColor2;
- switch (Open)
- {
- case Open.Top:
- {
- frame1.GetMiY_MaY(out var MM7);
- PlusBrush = Oth.GetLGB(Unit, MM7, ref PlusColor2, ref PlusColor1);
- if (Range == Range.MinusPlus)
- {
- frame2.GetMiY_MaY(out var MM8);
- MinusBrush = Oth.GetLGB(Unit, MM8, ref MinusColor1, ref MinusColor2);
- }
- break;
- }
- case Open.Bot:
- {
- frame1.GetMaY_MiY(out var MM3);
- PlusBrush = Oth.GetLGB(Unit, MM3, ref PlusColor2, ref PlusColor1);
- if (Range == Range.MinusPlus)
- {
- frame2.GetMaY_MiY(out var MM4);
- MinusBrush = Oth.GetLGB(Unit, MM4, ref MinusColor1, ref MinusColor2);
- }
- break;
- }
- case Open.Rig:
- {
- frame1.GetMaX_MiX(out var MM5);
- PlusBrush = Oth.GetLGB(Unit, MM5, ref PlusColor2, ref PlusColor1);
- if (Range == Range.MinusPlus)
- {
- frame2.GetMaX_MiX(out var MM6);
- MinusBrush = Oth.GetLGB(Unit, MM6, ref MinusColor1, ref MinusColor2);
- }
- break;
- }
- case Open.Lef:
- {
- frame1.GetMiX_MaX(out var MM);
- PlusBrush = Oth.GetLGB(Unit, MM, ref PlusColor2, ref PlusColor1);
- if (Range == Range.MinusPlus)
- {
- frame2.GetMiX_MaX(out var MM2);
- MinusBrush = Oth.GetLGB(Unit, MM2, ref MinusColor1, ref MinusColor2);
- }
- break;
- }
- }
- }
-
- public void SetAlphaG(double Alpha)
- {
- switch (Open)
- {
- case Open.Top:
- {
- PlusBrush.Dispose();
- frame1.GetMiY_MaY(out var MM7);
- PlusBrush = Oth.GetLGB(Unit, MM7, Color.FromArgb((int)(255.0 * Alpha), PlusColor2), Color.FromArgb((int)(255.0 * Alpha), PlusColor1));
- if (Range == Range.MinusPlus)
- {
- MinusBrush.Dispose();
- frame2.GetMiY_MaY(out var MM8);
- MinusBrush = Oth.GetLGB(Unit, MM8, Color.FromArgb((int)(255.0 * Alpha), MinusColor1), Color.FromArgb((int)(255.0 * Alpha), MinusColor2));
- }
- break;
- }
- case Open.Bot:
- {
- PlusBrush.Dispose();
- frame1.GetMaY_MiY(out var MM3);
- PlusBrush = Oth.GetLGB(Unit, MM3, Color.FromArgb((int)(255.0 * Alpha), PlusColor2), Color.FromArgb((int)(255.0 * Alpha), PlusColor1));
- if (Range == Range.MinusPlus)
- {
- MinusBrush.Dispose();
- frame2.GetMaY_MiY(out var MM4);
- MinusBrush = Oth.GetLGB(Unit, MM4, Color.FromArgb((int)(255.0 * Alpha), MinusColor1), Color.FromArgb((int)(255.0 * Alpha), MinusColor2));
- }
- break;
- }
- case Open.Rig:
- {
- PlusBrush.Dispose();
- frame1.GetMaX_MiX(out var MM5);
- PlusBrush = Oth.GetLGB(Unit, MM5, Color.FromArgb((int)(255.0 * Alpha), PlusColor2), Color.FromArgb((int)(255.0 * Alpha), PlusColor1));
- if (Range == Range.MinusPlus)
- {
- MinusBrush.Dispose();
- frame2.GetMaX_MiX(out var MM6);
- MinusBrush = Oth.GetLGB(Unit, MM6, Color.FromArgb((int)(255.0 * Alpha), MinusColor1), Color.FromArgb((int)(255.0 * Alpha), MinusColor2));
- }
- break;
- }
- case Open.Lef:
- {
- PlusBrush.Dispose();
- frame1.GetMiX_MaX(out var MM);
- PlusBrush = Oth.GetLGB(Unit, MM, Color.FromArgb((int)(255.0 * Alpha), PlusColor2), Color.FromArgb((int)(255.0 * Alpha), PlusColor1));
- if (Range == Range.MinusPlus)
- {
- MinusBrush.Dispose();
- frame2.GetMiX_MaX(out var MM2);
- MinusBrush = Oth.GetLGB(Unit, MM2, Color.FromArgb((int)(255.0 * Alpha), MinusColor1), Color.FromArgb((int)(255.0 * Alpha), MinusColor2));
- }
- break;
- }
- }
- }
-
- private double GetMax()
- {
- return Open switch
- {
- Open.Top => (0.0 - gauge.SizeY) * gauge.Size,
- Open.Bot => gauge.SizeY * gauge.Size,
- Open.Rig => gauge.SizeX * gauge.Size,
- Open.Lef => (0.0 - gauge.SizeX) * gauge.Size,
- _ => 0.0,
- };
- }
-
- private double GetDifference(ref Vector2D CursorPosition)
- {
- if (Open == Open.Top || Open == Open.Bot)
- {
- return CursorPosition.Y - op.Y;
- }
- if (Open == Open.Lef || Open == Open.Rig)
- {
- return CursorPosition.X - op.X;
- }
- return 0.0;
- }
-
- public Gau(string Name, ref Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, ref Color PlusColor, ref Color MinusColor, ref Color BackColor, bool Knob)
- {
- this.Open = Open;
- this.Range = Range;
- PlusBrush = new SolidBrush(PlusColor);
- MinusBrush = new SolidBrush(MinusColor);
- ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
- Max = GetMax();
- Value = 0.0;
- }
-
- public Gau(string Name, Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, Color PlusColor, Color MinusColor, Color BackColor, bool Knob)
- {
- this.Open = Open;
- this.Range = Range;
- PlusBrush = new SolidBrush(PlusColor);
- MinusBrush = new SolidBrush(MinusColor);
- ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
- Max = GetMax();
- Value = 0.0;
- }
-
- public Gau(string Name, ref Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, double DisUnit, ref Color PlusColor1, ref Color PlusColor2, ref Color MinusColor1, ref Color MinusColor2, ref Color BackColor, bool Knob)
- {
- this.Open = Open;
- this.Range = Range;
- ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
- SetBrush(DisUnit, ref PlusColor1, ref PlusColor2, ref MinusColor1, ref MinusColor2);
- Max = GetMax();
- Value = 0.0;
- }
-
- public Gau(string Name, Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, double DisUnit, Color PlusColor1, Color PlusColor2, Color MinusColor1, Color MinusColor2, Color BackColor, bool Knob)
- {
- this.Open = Open;
- this.Range = Range;
- ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
- SetBrush(DisUnit, ref PlusColor1, ref PlusColor2, ref MinusColor1, ref MinusColor2);
- Max = GetMax();
- Value = 0.0;
- }
-
- public bool Down(ref Color HitColor, ref Vector2D CursorPosition)
- {
- if (knob != null && knob.HitColor == HitColor)
- {
- Grip = true;
- op = CursorPosition;
- return true;
- }
- return false;
- }
-
- public bool Up()
- {
- if (Grip)
- {
- Grip = false;
- return true;
- }
- return false;
- }
-
- public bool Move(ref Vector2D CursorPosition)
- {
- if (Grip)
- {
- Value += GetDifference(ref CursorPosition) / Max;
- op = CursorPosition;
- return true;
- }
- return false;
- }
-
- public bool Leave()
- {
- if (Grip)
- {
- Grip = false;
- return true;
- }
- return false;
- }
-
- public void Dispose()
- {
- pars.Dispose();
- PlusBrush.Dispose();
- if (MinusBrush != null)
- {
- MinusBrush.Dispose();
- }
- }
+ private Vector2D TR1 => frame1.OP[0].ps[1];
+
+ private Vector2D BR1 => frame1.OP[0].ps[2];
+
+ private Vector2D BL1 => frame1.OP[0].ps[3];
+
+ private Vector2D TL2 => frame2.OP[0].ps[0];
+
+ private Vector2D TR2 => frame2.OP[0].ps[1];
+
+ private Vector2D BR2 => frame2.OP[0].ps[2];
+
+ private Vector2D BL2 => frame2.OP[0].ps[3];
+
+ private Vector2D TLG => gauge.OP[0].ps[0];
+
+ private Vector2D TRG => gauge.OP[0].ps[1];
+
+ private Vector2D BRG => gauge.OP[0].ps[2];
+
+ private Vector2D BLG => gauge.OP[0].ps[3];
+
+ private void SetLimit()
+ {
+ if (Range == Range.ZeroOne)
+ {
+ val = val.Clamp(0.0, 1.0);
+ }
+ else
+ {
+ val = val.Clamp(-1.0, 1.0);
+ }
+ }
+
+ private void SetColor()
+ {
+ if (val > 0.0)
+ {
+ gauge.SetBrush(PlusBrush);
+ }
+ else
+ {
+ gauge.SetBrush(MinusBrush);
+ }
+ }
+
+ private void SetValue()
+ {
+ if (Open == Open.Top || Open == Open.Bot)
+ {
+ gauge.SizeYCont = val;
+ }
+ else if (Open == Open.Lef || Open == Open.Rig)
+ {
+ gauge.SizeXCont = val;
+ }
+ if (knob != null)
+ {
+ knob.PositionBase = GetKnobPosition();
+ }
+ }
+
+ private Vector2D GetBasePoint1()
+ {
+ if (Range == Range.MinusPlus)
+ {
+ switch (Open)
+ {
+ case Open.Top:
+ return (BL1 + BR1) * 0.5;
+ case Open.Bot:
+ return (TL1 + TR1) * 0.5;
+ case Open.Rig:
+ return (TL1 + BL1) * 0.5;
+ case Open.Lef:
+ return (TR1 + BR1) * 0.5;
+ }
+ }
+ return frame1.OP.GetCenter();
+ }
+
+ private Vector2D GetBasePoint2()
+ {
+ if (Range == Range.MinusPlus)
+ {
+ switch (Open)
+ {
+ case Open.Top:
+ return (TL2 + TR2) * 0.5;
+ case Open.Bot:
+ return (BL2 + BR2) * 0.5;
+ case Open.Rig:
+ return (TR2 + BR2) * 0.5;
+ case Open.Lef:
+ return (TL2 + BL2) * 0.5;
+ }
+ }
+ return frame2.OP.GetCenter();
+ }
+
+ private Vector2D GetBasePoint()
+ {
+ if (Range == Range.ZeroOne)
+ {
+ switch (Open)
+ {
+ case Open.Top:
+ return (BLG + BRG) * 0.5;
+ case Open.Bot:
+ return (TLG + TRG) * 0.5;
+ case Open.Rig:
+ return (TLG + BLG) * 0.5;
+ case Open.Lef:
+ return (TRG + BRG) * 0.5;
+ }
+ }
+ return frame1.BasePoint;
+ }
+
+ private double GetWidthMag()
+ {
+ if (Range == Range.MinusPlus && (Open == Open.Lef || Open == Open.Rig))
+ {
+ return 0.5;
+ }
+ return 1.0;
+ }
+
+ private double GetHeightMag()
+ {
+ if (Range == Range.MinusPlus && (Open == Open.Top || Open == Open.Bot))
+ {
+ return 0.5;
+ }
+ return 1.0;
+ }
+
+ private double GetGaugeWidthMag(double Margin)
+ {
+ if (Open == Open.Top || Open == Open.Bot)
+ {
+ return (Margin * 2.0).Inverse();
+ }
+ return 1.0;
+ }
+
+ private double GetGaugeHeightMag(double Margin)
+ {
+ if (Open == Open.Lef || Open == Open.Rig)
+ {
+ return (Margin * 2.0).Inverse();
+ }
+ return 1.0;
+ }
+
+ private double GetKnobWidthMag(double Width)
+ {
+ if (Open == Open.Top || Open == Open.Bot)
+ {
+ return Width;
+ }
+ return 0.1;
+ }
+
+ private double GetKnobHeightMag(double Height)
+ {
+ if (Open == Open.Lef || Open == Open.Rig)
+ {
+ return Height;
+ }
+ return 0.1;
+ }
+
+ private Vector2D GetGaugePosition()
+ {
+ return Open switch
+ {
+ Open.Top => frame1.ToGlobal((BL1 + BR1) * 0.5),
+ Open.Bot => frame1.ToGlobal((TL1 + TR1) * 0.5),
+ Open.Rig => frame1.ToGlobal((TL1 + BL1) * 0.5),
+ Open.Lef => frame1.ToGlobal((TR1 + BR1) * 0.5),
+ _ => Dat.Vec2DZero,
+ };
+ }
+
+ private Vector2D GetKnobPosition()
+ {
+ return Open switch
+ {
+ Open.Top => gauge.ToGlobal((TLG + TRG) * 0.5),
+ Open.Bot => gauge.ToGlobal((BLG + BRG) * 0.5),
+ Open.Rig => gauge.ToGlobal((TRG + BRG) * 0.5),
+ Open.Lef => gauge.ToGlobal((TLG + BLG) * 0.5),
+ _ => Dat.Vec2DZero,
+ };
+ }
+
+ private void ParSetting(string Name, ref Vector2D Position, double Size, double Width, double Height, double Margin, ref Color BackColor, bool knob)
+ {
+ pars = new Pars();
+ base_ = new Par
+ {
+ Tag = Name + "_ベース",
+ InitializeOP = new Out[1] { Shas.Get正方形() },
+ PositionBase = Position,
+ SizeBase = Size,
+ SizeXBase = Width,
+ SizeYBase = Height,
+ Closed = true,
+ Pen = null,
+ BrushColor = BackColor
+ };
+ base_.BasePointBase = base_.OP.GetCenter();
+ pars.Add(base_.Tag, base_);
+ frame1 = new Par
+ {
+ Tag = Name + "_フレーム1",
+ InitializeOP = new Out[1] { Shas.Get正方形() },
+ PositionBase = Position,
+ SizeBase = Size,
+ SizeXBase = Width * GetWidthMag(),
+ SizeYBase = Height * GetHeightMag(),
+ Closed = true,
+ Brush = null
+ };
+ frame1.BasePointBase = GetBasePoint1();
+ pars.Add(frame1.Tag, frame1);
+ if (Range == Range.MinusPlus)
+ {
+ frame2 = new Par
+ {
+ Tag = Name + "_フレーム2",
+ InitializeOP = new Out[1] { Shas.Get正方形() },
+ PositionBase = Position,
+ SizeBase = Size,
+ SizeXBase = Width * GetWidthMag(),
+ SizeYBase = Height * GetHeightMag(),
+ Closed = true,
+ Brush = null
+ };
+ frame2.BasePointBase = GetBasePoint2();
+ pars.Add(frame2.Tag, frame2);
+ }
+ gauge = new Par
+ {
+ Tag = Name + "_ゲージ",
+ InitializeOP = new Out[1] { Shas.Get正方形() },
+ PositionBase = GetGaugePosition(),
+ SizeBase = Size,
+ SizeXBase = Width * GetWidthMag() * GetGaugeWidthMag(Margin),
+ SizeYBase = Height * GetHeightMag() * GetGaugeHeightMag(Margin),
+ Closed = true
+ };
+ gauge.BasePointBase = GetBasePoint();
+ pars.Add(gauge.Tag, gauge);
+ if (knob)
+ {
+ this.knob = new Par
+ {
+ Tag = Name + "_ノブ",
+ InitializeOP = new Out[1] { Shas.Get正方形() },
+ SizeBase = Size,
+ SizeXBase = GetKnobWidthMag(Width),
+ SizeYBase = GetKnobHeightMag(Height),
+ Closed = true,
+ BrushColor = Color.FromArgb(128, Color.White)
+ };
+ this.knob.BasePointBase = this.knob.OP.GetCenter();
+ pars.Add(this.knob.Tag, this.knob);
+ }
+ }
+
+ public void SetHitColor(Med Med)
+ {
+ if (base_.HitColor != Color.Transparent)
+ {
+ Med.RemUniqueColor(base_.HitColor);
+ }
+ base_.HitColor = Med.GetUniqueColor();
+ if (frame1.HitColor != Color.Transparent)
+ {
+ Med.RemUniqueColor(frame1.HitColor);
+ }
+ frame1.HitColor = Med.GetUniqueColor();
+ if (Range == Range.MinusPlus)
+ {
+ if (frame2.HitColor != Color.Transparent)
+ {
+ Med.RemUniqueColor(frame2.HitColor);
+ }
+ frame2.HitColor = Med.GetUniqueColor();
+ }
+ if (gauge.HitColor != Color.Transparent)
+ {
+ Med.RemUniqueColor(gauge.HitColor);
+ }
+ gauge.HitColor = Med.GetUniqueColor();
+ if (knob != null)
+ {
+ if (knob.HitColor != Color.Transparent)
+ {
+ Med.RemUniqueColor(knob.HitColor);
+ }
+ knob.HitColor = Med.GetUniqueColor();
+ }
+ }
+
+ private void SetBrush(double Unit, ref Color PlusColor1, ref Color PlusColor2, ref Color MinusColor1, ref Color MinusColor2)
+ {
+ this.Unit = Unit;
+ this.PlusColor1 = PlusColor1;
+ this.PlusColor2 = PlusColor2;
+ this.MinusColor1 = MinusColor1;
+ this.MinusColor2 = MinusColor2;
+ switch (Open)
+ {
+ case Open.Top:
+ {
+ frame1.GetMiY_MaY(out var MM7);
+ PlusBrush = Oth.GetLGB(Unit, MM7, ref PlusColor2, ref PlusColor1);
+ if (Range == Range.MinusPlus)
+ {
+ frame2.GetMiY_MaY(out var MM8);
+ MinusBrush = Oth.GetLGB(Unit, MM8, ref MinusColor1, ref MinusColor2);
+ }
+ break;
+ }
+ case Open.Bot:
+ {
+ frame1.GetMaY_MiY(out var MM3);
+ PlusBrush = Oth.GetLGB(Unit, MM3, ref PlusColor2, ref PlusColor1);
+ if (Range == Range.MinusPlus)
+ {
+ frame2.GetMaY_MiY(out var MM4);
+ MinusBrush = Oth.GetLGB(Unit, MM4, ref MinusColor1, ref MinusColor2);
+ }
+ break;
+ }
+ case Open.Rig:
+ {
+ frame1.GetMaX_MiX(out var MM5);
+ PlusBrush = Oth.GetLGB(Unit, MM5, ref PlusColor2, ref PlusColor1);
+ if (Range == Range.MinusPlus)
+ {
+ frame2.GetMaX_MiX(out var MM6);
+ MinusBrush = Oth.GetLGB(Unit, MM6, ref MinusColor1, ref MinusColor2);
+ }
+ break;
+ }
+ case Open.Lef:
+ {
+ frame1.GetMiX_MaX(out var MM);
+ PlusBrush = Oth.GetLGB(Unit, MM, ref PlusColor2, ref PlusColor1);
+ if (Range == Range.MinusPlus)
+ {
+ frame2.GetMiX_MaX(out var MM2);
+ MinusBrush = Oth.GetLGB(Unit, MM2, ref MinusColor1, ref MinusColor2);
+ }
+ break;
+ }
+ }
+ }
+
+ public void SetAlphaG(double Alpha)
+ {
+ switch (Open)
+ {
+ case Open.Top:
+ {
+ PlusBrush.Dispose();
+ frame1.GetMiY_MaY(out var MM7);
+ PlusBrush = Oth.GetLGB(Unit, MM7, Color.FromArgb((int)(255.0 * Alpha), PlusColor2), Color.FromArgb((int)(255.0 * Alpha), PlusColor1));
+ if (Range == Range.MinusPlus)
+ {
+ MinusBrush.Dispose();
+ frame2.GetMiY_MaY(out var MM8);
+ MinusBrush = Oth.GetLGB(Unit, MM8, Color.FromArgb((int)(255.0 * Alpha), MinusColor1), Color.FromArgb((int)(255.0 * Alpha), MinusColor2));
+ }
+ break;
+ }
+ case Open.Bot:
+ {
+ PlusBrush.Dispose();
+ frame1.GetMaY_MiY(out var MM3);
+ PlusBrush = Oth.GetLGB(Unit, MM3, Color.FromArgb((int)(255.0 * Alpha), PlusColor2), Color.FromArgb((int)(255.0 * Alpha), PlusColor1));
+ if (Range == Range.MinusPlus)
+ {
+ MinusBrush.Dispose();
+ frame2.GetMaY_MiY(out var MM4);
+ MinusBrush = Oth.GetLGB(Unit, MM4, Color.FromArgb((int)(255.0 * Alpha), MinusColor1), Color.FromArgb((int)(255.0 * Alpha), MinusColor2));
+ }
+ break;
+ }
+ case Open.Rig:
+ {
+ PlusBrush.Dispose();
+ frame1.GetMaX_MiX(out var MM5);
+ PlusBrush = Oth.GetLGB(Unit, MM5, Color.FromArgb((int)(255.0 * Alpha), PlusColor2), Color.FromArgb((int)(255.0 * Alpha), PlusColor1));
+ if (Range == Range.MinusPlus)
+ {
+ MinusBrush.Dispose();
+ frame2.GetMaX_MiX(out var MM6);
+ MinusBrush = Oth.GetLGB(Unit, MM6, Color.FromArgb((int)(255.0 * Alpha), MinusColor1), Color.FromArgb((int)(255.0 * Alpha), MinusColor2));
+ }
+ break;
+ }
+ case Open.Lef:
+ {
+ PlusBrush.Dispose();
+ frame1.GetMiX_MaX(out var MM);
+ PlusBrush = Oth.GetLGB(Unit, MM, Color.FromArgb((int)(255.0 * Alpha), PlusColor2), Color.FromArgb((int)(255.0 * Alpha), PlusColor1));
+ if (Range == Range.MinusPlus)
+ {
+ MinusBrush.Dispose();
+ frame2.GetMiX_MaX(out var MM2);
+ MinusBrush = Oth.GetLGB(Unit, MM2, Color.FromArgb((int)(255.0 * Alpha), MinusColor1), Color.FromArgb((int)(255.0 * Alpha), MinusColor2));
+ }
+ break;
+ }
+ }
+ }
+
+ private double GetMax()
+ {
+ return Open switch
+ {
+ Open.Top => (0.0 - gauge.SizeY) * gauge.Size,
+ Open.Bot => gauge.SizeY * gauge.Size,
+ Open.Rig => gauge.SizeX * gauge.Size,
+ Open.Lef => (0.0 - gauge.SizeX) * gauge.Size,
+ _ => 0.0,
+ };
+ }
+
+ private double GetDifference(ref Vector2D CursorPosition)
+ {
+ if (Open == Open.Top || Open == Open.Bot)
+ {
+ return CursorPosition.Y - op.Y;
+ }
+ if (Open == Open.Lef || Open == Open.Rig)
+ {
+ return CursorPosition.X - op.X;
+ }
+ return 0.0;
+ }
+
+ public Gau(string Name, ref Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, ref Color PlusColor, ref Color MinusColor, ref Color BackColor, bool Knob)
+ {
+ this.Open = Open;
+ this.Range = Range;
+ PlusBrush = new SolidBrush(PlusColor);
+ MinusBrush = new SolidBrush(MinusColor);
+ ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
+ Max = GetMax();
+ Value = 0.0;
+ }
+
+ public Gau(string Name, Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, Color PlusColor, Color MinusColor, Color BackColor, bool Knob)
+ {
+ this.Open = Open;
+ this.Range = Range;
+ PlusBrush = new SolidBrush(PlusColor);
+ MinusBrush = new SolidBrush(MinusColor);
+ ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
+ Max = GetMax();
+ Value = 0.0;
+ }
+
+ public Gau(string Name, ref Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, double DisUnit, ref Color PlusColor1, ref Color PlusColor2, ref Color MinusColor1, ref Color MinusColor2, ref Color BackColor, bool Knob)
+ {
+ this.Open = Open;
+ this.Range = Range;
+ ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
+ SetBrush(DisUnit, ref PlusColor1, ref PlusColor2, ref MinusColor1, ref MinusColor2);
+ Max = GetMax();
+ Value = 0.0;
+ }
+
+ public Gau(string Name, Vector2D Position, double Size, double Width, double Height, double Margin, Open Open, Range Range, double DisUnit, Color PlusColor1, Color PlusColor2, Color MinusColor1, Color MinusColor2, Color BackColor, bool Knob)
+ {
+ this.Open = Open;
+ this.Range = Range;
+ ParSetting(Name, ref Position, Size, Width, Height, Margin, ref BackColor, Knob);
+ SetBrush(DisUnit, ref PlusColor1, ref PlusColor2, ref MinusColor1, ref MinusColor2);
+ Max = GetMax();
+ Value = 0.0;
+ }
+
+ public bool Down(ref Color HitColor, ref Vector2D CursorPosition)
+ {
+ if (knob != null && knob.HitColor == HitColor)
+ {
+ Grip = true;
+ op = CursorPosition;
+ return true;
+ }
+ return false;
+ }
+
+ public bool Up()
+ {
+ if (Grip)
+ {
+ Grip = false;
+ return true;
+ }
+ return false;
+ }
+
+ public bool Move(ref Vector2D CursorPosition)
+ {
+ if (Grip)
+ {
+ Value += GetDifference(ref CursorPosition) / Max;
+ op = CursorPosition;
+ return true;
+ }
+ return false;
+ }
+
+ public bool Leave()
+ {
+ if (Grip)
+ {
+ Grip = false;
+ return true;
+ }
+ return false;
+ }
+
+ public void Dispose()
+ {
+ pars.Dispose();
+ PlusBrush.Dispose();
+ if (MinusBrush != null)
+ {
+ MinusBrush.Dispose();
+ }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/HSV.cs b/2DGAMELIB/_2DGAMELIB/HSV.cs
index 6f462eb..1866184 100644
--- a/2DGAMELIB/_2DGAMELIB/HSV.cs
+++ b/2DGAMELIB/_2DGAMELIB/HSV.cs
@@ -1,306 +1,307 @@
using System.Drawing;
-namespace _2DGAMELIB;
-
-public static class HSV
+namespace _2DGAMELIB
{
- public static void ToHSV(int r, int g, int b, out int h, out int s, out int v)
- {
- v = GetMax(r, g, b);
- int num = v - GetMin(r, g, b);
- if (num == 0)
- {
- s = 0;
- }
- else
- {
- s = (int)((double)(num * 255) / (double)v);
- }
- if (s == 0)
- {
- h = 0;
- return;
- }
- double num2 = num;
- if (r == v)
- {
- h = v - (int)((double)(b * 60) / num2) - (v - (int)((double)(g * 60) / num2));
- }
- else if (g == v)
- {
- h = 120 + (v - (int)((double)(r * 60) / num2)) - (v - (int)((double)(b * 60) / num2));
- }
- else
- {
- h = 240 + (v - (int)((double)(g * 60) / num2)) - (v - (int)((double)(r * 60) / num2));
- }
- if (h < 0)
- {
- h += 360;
- }
- }
+ public static class HSV
+ {
+ public static void ToHSV(int r, int g, int b, out int h, out int s, out int v)
+ {
+ v = GetMax(r, g, b);
+ int num = v - GetMin(r, g, b);
+ if (num == 0)
+ {
+ s = 0;
+ }
+ else
+ {
+ s = (int)((double)(num * 255) / (double)v);
+ }
+ if (s == 0)
+ {
+ h = 0;
+ return;
+ }
+ double num2 = num;
+ if (r == v)
+ {
+ h = v - (int)((double)(b * 60) / num2) - (v - (int)((double)(g * 60) / num2));
+ }
+ else if (g == v)
+ {
+ h = 120 + (v - (int)((double)(r * 60) / num2)) - (v - (int)((double)(b * 60) / num2));
+ }
+ else
+ {
+ h = 240 + (v - (int)((double)(g * 60) / num2)) - (v - (int)((double)(r * 60) / num2));
+ }
+ if (h < 0)
+ {
+ h += 360;
+ }
+ }
- public static void ToRGB(int h, int s, int v, out int r, out int g, out int b)
- {
- if (s == 0)
- {
- r = (g = (b = v));
- return;
- }
- int num = h * 6;
- switch (num / 360)
- {
- case 0:
- r = v;
- g = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0);
- b = (int)((double)(v * (255 - s)) / 255.0);
- break;
- case 1:
- r = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0);
- g = v;
- b = (int)((double)(v * (255 - s)) / 255.0);
- break;
- case 2:
- r = (int)((double)(v * (255 - s)) / 255.0);
- g = v;
- b = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0);
- break;
- case 3:
- r = (int)((double)(v * (255 - s)) / 255.0);
- g = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0);
- b = v;
- break;
- case 4:
- r = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0);
- g = (int)((double)(v * (255 - s)) / 255.0);
- b = v;
- break;
- default:
- r = v;
- g = (int)((double)(v * (255 - s)) / 255.0);
- b = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0);
- break;
- }
- }
+ public static void ToRGB(int h, int s, int v, out int r, out int g, out int b)
+ {
+ if (s == 0)
+ {
+ r = (g = (b = v));
+ return;
+ }
+ int num = h * 6;
+ switch (num / 360)
+ {
+ case 0:
+ r = v;
+ g = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0);
+ b = (int)((double)(v * (255 - s)) / 255.0);
+ break;
+ case 1:
+ r = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0);
+ g = v;
+ b = (int)((double)(v * (255 - s)) / 255.0);
+ break;
+ case 2:
+ r = (int)((double)(v * (255 - s)) / 255.0);
+ g = v;
+ b = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0);
+ break;
+ case 3:
+ r = (int)((double)(v * (255 - s)) / 255.0);
+ g = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0);
+ b = v;
+ break;
+ case 4:
+ r = (int)((double)(v * (255 - (int)((double)(s * (360 - num % 360)) / 360.0))) / 255.0);
+ g = (int)((double)(v * (255 - s)) / 255.0);
+ b = v;
+ break;
+ default:
+ r = v;
+ g = (int)((double)(v * (255 - s)) / 255.0);
+ b = (int)((double)(v * (255 - (int)((double)(s * (num % 360)) / 360.0))) / 255.0);
+ break;
+ }
+ }
- public static void ToHSV(this Color col, out int h, out int s, out int v)
- {
- ToHSV(col.R, col.G, col.B, out h, out s, out v);
- }
+ public static void ToHSV(this Color col, out int h, out int s, out int v)
+ {
+ ToHSV(col.R, col.G, col.B, out h, out s, out v);
+ }
- public static void ToHSV(ref Color col, out int h, out int s, out int v)
- {
- ToHSV(col.R, col.G, col.B, out h, out s, out v);
- }
+ public static void ToHSV(ref Color col, out int h, out int s, out int v)
+ {
+ ToHSV(col.R, col.G, col.B, out h, out s, out v);
+ }
- public static void ToRGB(int h, int s, int v, out Color ret)
- {
- ToRGB(h, s, v, out var r, out var g, out var b);
- ret = Color.FromArgb(r, g, b);
- }
+ public static void ToRGB(int h, int s, int v, out Color ret)
+ {
+ ToRGB(h, s, v, out var r, out var g, out var b);
+ ret = Color.FromArgb(r, g, b);
+ }
- public static void ToRGB(int h, int s, int v, int a, out Color ret)
- {
- ToRGB(h, s, v, out var r, out var g, out var b);
- ret = Color.FromArgb(a, r, g, b);
- }
+ public static void ToRGB(int h, int s, int v, int a, out Color ret)
+ {
+ ToRGB(h, s, v, out var r, out var g, out var b);
+ ret = Color.FromArgb(a, r, g, b);
+ }
- public static void ToRGB(this Hsv hsv, out int r, out int g, out int b)
- {
- ToRGB(hsv.H, hsv.S, hsv.V, out r, out g, out b);
- }
+ public static void ToRGB(this Hsv hsv, out int r, out int g, out int b)
+ {
+ ToRGB(hsv.H, hsv.S, hsv.V, out r, out g, out b);
+ }
- public static void ToRGB(ref Hsv hsv, out int r, out int g, out int b)
- {
- ToRGB(hsv.H, hsv.S, hsv.V, out r, out g, out b);
- }
+ public static void ToRGB(ref Hsv hsv, out int r, out int g, out int b)
+ {
+ ToRGB(hsv.H, hsv.S, hsv.V, out r, out g, out b);
+ }
- public static Hsv ToHSV(int r, int g, int b)
- {
- Hsv result = default(Hsv);
- ToHSV(r, g, b, out result.H, out result.S, out result.V);
- return result;
- }
+ public static Hsv ToHSV(int r, int g, int b)
+ {
+ Hsv result = default(Hsv);
+ ToHSV(r, g, b, out result.H, out result.S, out result.V);
+ return result;
+ }
- public static Hsv ToHSV(this Color col)
- {
- Hsv result = default(Hsv);
- ToHSV(col.R, col.G, col.B, out result.H, out result.S, out result.V);
- return result;
- }
+ public static Hsv ToHSV(this Color col)
+ {
+ Hsv result = default(Hsv);
+ ToHSV(col.R, col.G, col.B, out result.H, out result.S, out result.V);
+ return result;
+ }
- public static Hsv ToHSV(ref Color col)
- {
- Hsv result = default(Hsv);
- ToHSV(col.R, col.G, col.B, out result.H, out result.S, out result.V);
- return result;
- }
+ public static Hsv ToHSV(ref Color col)
+ {
+ Hsv result = default(Hsv);
+ ToHSV(col.R, col.G, col.B, out result.H, out result.S, out result.V);
+ return result;
+ }
- public static Color ToRGB(this Hsv hsv)
- {
- ToRGB(hsv.H, hsv.S, hsv.V, out var r, out var g, out var b);
- return Color.FromArgb(r, g, b);
- }
+ public static Color ToRGB(this Hsv hsv)
+ {
+ ToRGB(hsv.H, hsv.S, hsv.V, out var r, out var g, out var b);
+ return Color.FromArgb(r, g, b);
+ }
- public static Color ToRGB(ref Hsv hsv)
- {
- ToRGB(hsv.H, hsv.S, hsv.V, out var r, out var g, out var b);
- return Color.FromArgb(r, g, b);
- }
+ public static Color ToRGB(ref Hsv hsv)
+ {
+ ToRGB(hsv.H, hsv.S, hsv.V, out var r, out var g, out var b);
+ return Color.FromArgb(r, g, b);
+ }
- private static int GetMax(int x, int y, int z)
- {
- if (x < y)
- {
- if (z >= y)
- {
- return z;
- }
- return y;
- }
- if (z < x)
- {
- return x;
- }
- return z;
- }
+ private static int GetMax(int x, int y, int z)
+ {
+ if (x < y)
+ {
+ if (z >= y)
+ {
+ return z;
+ }
+ return y;
+ }
+ if (z < x)
+ {
+ return x;
+ }
+ return z;
+ }
- private static int GetMin(int x, int y, int z)
- {
- if (x > y)
- {
- if (z <= y)
- {
- return z;
- }
- return y;
- }
- if (z > x)
- {
- return x;
- }
- return z;
- }
-}
-public struct Hsv
-{
- public int H;
-
- public int S;
-
- public int V;
-
- public int Hue
- {
- get
- {
- return H;
- }
- set
- {
- H = value;
- HueLimit();
- }
- }
-
- public int Sat
- {
- get
- {
- return S;
- }
- set
- {
- S = value;
- SatLimit();
- }
- }
-
- public int Val
- {
- get
- {
- return V;
- }
- set
- {
- V = value;
- ValLimit();
- }
- }
-
- public Hsv(Color Color)
- {
- HSV.ToHSV(Color.R, Color.G, Color.B, out H, out S, out V);
- }
-
- public Hsv(ref Color Color)
- {
- HSV.ToHSV(Color.R, Color.G, Color.B, out H, out S, out V);
- }
-
- public Hsv(int Hue, int Sat, int Val)
- {
- H = Hue;
- S = Sat;
- V = Val;
- }
-
- private void HueLimit()
- {
- H %= 360;
- }
-
- private void SatLimit()
- {
- if (S > 255)
- {
- S = 255;
- }
- else if (S < 0)
- {
- S = 0;
- }
- }
-
- private void ValLimit()
- {
- if (V > 255)
- {
- V = 255;
- }
- else if (V < 0)
- {
- V = 0;
- }
- }
-
- public Color GetColor()
- {
- HSV.ToRGB(H, S, V, out var r, out var g, out var b);
- return Color.FromArgb(r, g, b);
- }
-
- public Color GetColor(int a)
- {
- HSV.ToRGB(H, S, V, out var r, out var g, out var b);
- return Color.FromArgb(a, r, g, b);
- }
-
- public void GetColor(out Color ret)
- {
- HSV.ToRGB(H, S, V, out var r, out var g, out var b);
- ret = Color.FromArgb(r, g, b);
- }
-
- public void GetColor(int a, out Color ret)
- {
- HSV.ToRGB(H, S, V, out var r, out var g, out var b);
- ret = Color.FromArgb(a, r, g, b);
- }
-
- public override string ToString()
- {
- return "H : " + H + " S : " + S + " V : " + V;
- }
+ private static int GetMin(int x, int y, int z)
+ {
+ if (x > y)
+ {
+ if (z <= y)
+ {
+ return z;
+ }
+ return y;
+ }
+ if (z > x)
+ {
+ return x;
+ }
+ return z;
+ }
+ }
+ public struct Hsv
+ {
+ public int H;
+
+ public int S;
+
+ public int V;
+
+ public int Hue
+ {
+ get
+ {
+ return H;
+ }
+ set
+ {
+ H = value;
+ HueLimit();
+ }
+ }
+
+ public int Sat
+ {
+ get
+ {
+ return S;
+ }
+ set
+ {
+ S = value;
+ SatLimit();
+ }
+ }
+
+ public int Val
+ {
+ get
+ {
+ return V;
+ }
+ set
+ {
+ V = value;
+ ValLimit();
+ }
+ }
+
+ public Hsv(Color Color)
+ {
+ HSV.ToHSV(Color.R, Color.G, Color.B, out H, out S, out V);
+ }
+
+ public Hsv(ref Color Color)
+ {
+ HSV.ToHSV(Color.R, Color.G, Color.B, out H, out S, out V);
+ }
+
+ public Hsv(int Hue, int Sat, int Val)
+ {
+ H = Hue;
+ S = Sat;
+ V = Val;
+ }
+
+ private void HueLimit()
+ {
+ H %= 360;
+ }
+
+ private void SatLimit()
+ {
+ if (S > 255)
+ {
+ S = 255;
+ }
+ else if (S < 0)
+ {
+ S = 0;
+ }
+ }
+
+ private void ValLimit()
+ {
+ if (V > 255)
+ {
+ V = 255;
+ }
+ else if (V < 0)
+ {
+ V = 0;
+ }
+ }
+
+ public Color GetColor()
+ {
+ HSV.ToRGB(H, S, V, out var r, out var g, out var b);
+ return Color.FromArgb(r, g, b);
+ }
+
+ public Color GetColor(int a)
+ {
+ HSV.ToRGB(H, S, V, out var r, out var g, out var b);
+ return Color.FromArgb(a, r, g, b);
+ }
+
+ public void GetColor(out Color ret)
+ {
+ HSV.ToRGB(H, S, V, out var r, out var g, out var b);
+ ret = Color.FromArgb(r, g, b);
+ }
+
+ public void GetColor(int a, out Color ret)
+ {
+ HSV.ToRGB(H, S, V, out var r, out var g, out var b);
+ ret = Color.FromArgb(a, r, g, b);
+ }
+
+ public override string ToString()
+ {
+ return "H : " + H + " S : " + S + " V : " + V;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Joi.cs b/2DGAMELIB/_2DGAMELIB/Joi.cs
index 4df4a66..578ea6a 100644
--- a/2DGAMELIB/_2DGAMELIB/Joi.cs
+++ b/2DGAMELIB/_2DGAMELIB/Joi.cs
@@ -1,31 +1,32 @@
using System;
using System.IO;
-namespace _2DGAMELIB;
-
-
-//its the position of a joint
-[Serializable]
-public class Joi
+namespace _2DGAMELIB
{
- public Vector2D Joint = Dat.Vec2DZero;
- public Joi()
- {
- }
+ //its the position of a joint
+ [Serializable]
+ public class Joi
+ {
+ public Vector2D Joint = Dat.Vec2DZero;
- public Joi(Joi Joi)
- {
- Joint = Joi.Joint;
- }
+ public Joi()
+ {
+ }
- public Joi(Vector2D Joint)
- {
- this.Joint = Joint;
- }
+ public Joi(Joi Joi)
+ {
+ Joint = Joi.Joint;
+ }
- public Joi(ref Vector2D Joint)
- {
- this.Joint = Joint;
- }
+ public Joi(Vector2D Joint)
+ {
+ this.Joint = Joint;
+ }
+
+ public Joi(ref Vector2D Joint)
+ {
+ this.Joint = Joint;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Join.cs b/2DGAMELIB/_2DGAMELIB/Join.cs
index 471b6d8..9bc4d89 100644
--- a/2DGAMELIB/_2DGAMELIB/Join.cs
+++ b/2DGAMELIB/_2DGAMELIB/Join.cs
@@ -2,195 +2,196 @@ using System;
using System.Collections.Generic;
using System.Linq;
-namespace _2DGAMELIB;
-
-public static class Join
+namespace _2DGAMELIB
{
- public static double IdentityDistance = System.Math.Pow(5E-05, 2.0);
+ public static class Join
+ {
+ public static double IdentityDistance = System.Math.Pow(5E-05, 2.0);
- public static Joints GetJoints(this Par JoinRoot, IEnumerable EnumPar)
- {
- Joints joints = new Joints();
- int num = 0;
- List list = new List();
- List list2 = EnumPar.ToList();
- foreach (Joi item in JoinRoot.JP)
- {
- Vector2D v = JoinRoot.ToGlobal(item.Joint);
- int num2 = 0;
- list.Clear();
- foreach (Par item2 in list2)
- {
- if (JoinRoot != item2)
- {
- if (v.DistanceSquared(item2.Position) <= IdentityDistance)
- {
- joints.Joins.Add(new Joint(JoinRoot, num, item2));
- if (!list.Contains(num2))
- {
- list.Add(num2);
- }
- }
- }
- else if (!list.Contains(num2))
- {
- list.Add(num2);
- }
- num2++;
- }
- for (int num3 = list.Count - 1; num3 > -1; num3--)
- {
- list2.RemoveAt(list[num3]);
- }
- num++;
- }
- GetJoints(list2, joints, list);
- return joints;
- }
+ public static Joints GetJoints(this Par JoinRoot, IEnumerable EnumPar)
+ {
+ Joints joints = new Joints();
+ int num = 0;
+ List list = new List();
+ List list2 = EnumPar.ToList();
+ foreach (Joi item in JoinRoot.JP)
+ {
+ Vector2D v = JoinRoot.ToGlobal(item.Joint);
+ int num2 = 0;
+ list.Clear();
+ foreach (Par item2 in list2)
+ {
+ if (JoinRoot != item2)
+ {
+ if (v.DistanceSquared(item2.Position) <= IdentityDistance)
+ {
+ joints.Joins.Add(new Joint(JoinRoot, num, item2));
+ if (!list.Contains(num2))
+ {
+ list.Add(num2);
+ }
+ }
+ }
+ else if (!list.Contains(num2))
+ {
+ list.Add(num2);
+ }
+ num2++;
+ }
+ for (int num3 = list.Count - 1; num3 > -1; num3--)
+ {
+ list2.RemoveAt(list[num3]);
+ }
+ num++;
+ }
+ GetJoints(list2, joints, list);
+ return joints;
+ }
- private static void GetJoints(List pl, Joints js, List del)
- {
- int num = -1;
- int num2 = 0;
- while (num != js.Joins.Count)
- {
- num = js.Joins.Count;
- for (int i = num2; i < num; i++)
- {
- Par par = js.Joins[i].Par1;
- int num3 = 0;
- foreach (Joi item in par.JP)
- {
- Vector2D v = par.ToGlobal(item.Joint);
- int num4 = 0;
- del.Clear();
- foreach (Par item2 in pl)
- {
- if (par != item2)
- {
- if (v.DistanceSquared(item2.Position) <= IdentityDistance)
- {
- js.Joins.Add(new Joint(par, num3, item2));
- if (!del.Contains(num4))
- {
- del.Add(num4);
- }
- }
- }
- else if (!del.Contains(num4))
- {
- del.Add(num4);
- }
- num4++;
- }
- for (int num5 = del.Count - 1; num5 > -1; num5--)
- {
- pl.RemoveAt(del[num5]);
- }
- num3++;
- }
- }
- num2 = num;
- }
- }
+ private static void GetJoints(List pl, Joints js, List del)
+ {
+ int num = -1;
+ int num2 = 0;
+ while (num != js.Joins.Count)
+ {
+ num = js.Joins.Count;
+ for (int i = num2; i < num; i++)
+ {
+ Par par = js.Joins[i].Par1;
+ int num3 = 0;
+ foreach (Joi item in par.JP)
+ {
+ Vector2D v = par.ToGlobal(item.Joint);
+ int num4 = 0;
+ del.Clear();
+ foreach (Par item2 in pl)
+ {
+ if (par != item2)
+ {
+ if (v.DistanceSquared(item2.Position) <= IdentityDistance)
+ {
+ js.Joins.Add(new Joint(par, num3, item2));
+ if (!del.Contains(num4))
+ {
+ del.Add(num4);
+ }
+ }
+ }
+ else if (!del.Contains(num4))
+ {
+ del.Add(num4);
+ }
+ num4++;
+ }
+ for (int num5 = del.Count - 1; num5 > -1; num5--)
+ {
+ pl.RemoveAt(del[num5]);
+ }
+ num3++;
+ }
+ }
+ num2 = num;
+ }
+ }
- public static JointsD GetJointsD(this Difs JoinRoot, IEnumerable EnumDifs)
- {
- JointsD jointsD = new JointsD();
- List list = new List();
- List list2 = EnumDifs.ToList();
- foreach (Par item in JoinRoot.EnumAllPar())
- {
- int num = 0;
- list.Clear();
- foreach (Difs item2 in list2)
- {
- if (JoinRoot != item2)
- {
- int num2 = 0;
- foreach (Joi item3 in item.JP)
- {
- Vector2D v = item.ToGlobal(item3.Joint);
- foreach (Par item4 in item2.EnumJoinRoot)
- {
- if (v.DistanceSquared(item4.Position) <= IdentityDistance)
- {
- jointsD.Joins.Add(new JointD(JoinRoot, item, num2, item2));
- if (!list.Contains(num))
- {
- list.Add(num);
- }
- break;
- }
- }
- num2++;
- }
- }
- else if (!list.Contains(num))
- {
- list.Add(num);
- }
- num++;
- }
- for (int num3 = list.Count - 1; num3 > -1; num3--)
- {
- list2.RemoveAt(list[num3]);
- }
- }
- GetJointsD(list2, jointsD, list);
- return jointsD;
- }
+ public static JointsD GetJointsD(this Difs JoinRoot, IEnumerable EnumDifs)
+ {
+ JointsD jointsD = new JointsD();
+ List list = new List();
+ List list2 = EnumDifs.ToList();
+ foreach (Par item in JoinRoot.EnumAllPar())
+ {
+ int num = 0;
+ list.Clear();
+ foreach (Difs item2 in list2)
+ {
+ if (JoinRoot != item2)
+ {
+ int num2 = 0;
+ foreach (Joi item3 in item.JP)
+ {
+ Vector2D v = item.ToGlobal(item3.Joint);
+ foreach (Par item4 in item2.EnumJoinRoot)
+ {
+ if (v.DistanceSquared(item4.Position) <= IdentityDistance)
+ {
+ jointsD.Joins.Add(new JointD(JoinRoot, item, num2, item2));
+ if (!list.Contains(num))
+ {
+ list.Add(num);
+ }
+ break;
+ }
+ }
+ num2++;
+ }
+ }
+ else if (!list.Contains(num))
+ {
+ list.Add(num);
+ }
+ num++;
+ }
+ for (int num3 = list.Count - 1; num3 > -1; num3--)
+ {
+ list2.RemoveAt(list[num3]);
+ }
+ }
+ GetJointsD(list2, jointsD, list);
+ return jointsD;
+ }
- private static void GetJointsD(List dl, JointsD jsd, List del)
- {
- int num = -1;
- int num2 = 0;
- while (num != jsd.Joins.Count)
- {
- num = jsd.Joins.Count;
- for (int i = num2; i < num; i++)
- {
- Difs difs = jsd.Joins[i].Difs1;
- foreach (Par item in difs.EnumAllPar())
- {
- int num3 = 0;
- del.Clear();
- foreach (Difs item2 in dl)
- {
- if (difs != item2)
- {
- int num4 = 0;
- foreach (Joi item3 in item.JP)
- {
- Vector2D v = item.ToGlobal(item3.Joint);
- foreach (Par item4 in item2.EnumJoinRoot)
- {
- if (v.DistanceSquared(item4.Position) <= IdentityDistance)
- {
- jsd.Joins.Add(new JointD(difs, item, num4, item2));
- if (!del.Contains(num3))
- {
- del.Add(num3);
- }
- break;
- }
- }
- num4++;
- }
- }
- else if (!del.Contains(num3))
- {
- del.Add(num3);
- }
- num3++;
- }
- for (int num5 = del.Count - 1; num5 > -1; num5--)
- {
- dl.RemoveAt(del[num5]);
- }
- }
- }
- num2 = num;
- }
- }
+ private static void GetJointsD(List dl, JointsD jsd, List del)
+ {
+ int num = -1;
+ int num2 = 0;
+ while (num != jsd.Joins.Count)
+ {
+ num = jsd.Joins.Count;
+ for (int i = num2; i < num; i++)
+ {
+ Difs difs = jsd.Joins[i].Difs1;
+ foreach (Par item in difs.EnumAllPar())
+ {
+ int num3 = 0;
+ del.Clear();
+ foreach (Difs item2 in dl)
+ {
+ if (difs != item2)
+ {
+ int num4 = 0;
+ foreach (Joi item3 in item.JP)
+ {
+ Vector2D v = item.ToGlobal(item3.Joint);
+ foreach (Par item4 in item2.EnumJoinRoot)
+ {
+ if (v.DistanceSquared(item4.Position) <= IdentityDistance)
+ {
+ jsd.Joins.Add(new JointD(difs, item, num4, item2));
+ if (!del.Contains(num3))
+ {
+ del.Add(num3);
+ }
+ break;
+ }
+ }
+ num4++;
+ }
+ }
+ else if (!del.Contains(num3))
+ {
+ del.Add(num3);
+ }
+ num3++;
+ }
+ for (int num5 = del.Count - 1; num5 > -1; num5--)
+ {
+ dl.RemoveAt(del[num5]);
+ }
+ }
+ }
+ num2 = num;
+ }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Joint.cs b/2DGAMELIB/_2DGAMELIB/Joint.cs
index 37b98c3..9231c1d 100644
--- a/2DGAMELIB/_2DGAMELIB/Joint.cs
+++ b/2DGAMELIB/_2DGAMELIB/Joint.cs
@@ -1,30 +1,31 @@
using System;
-namespace _2DGAMELIB;
-
-[Serializable]
-public class Joint
+namespace _2DGAMELIB
{
- public Par Par0;
+ [Serializable]
+ public class Joint
+ {
+ public Par Par0;
- public int Index;
+ public int Index;
- public Par Par1;
+ public Par Par1;
- public Joint(Par Par0, int Index, Par Par1)
- {
- this.Par0 = Par0;
- this.Index = Index;
- this.Par1 = Par1;
- }
+ public Joint(Par Par0, int Index, Par Par1)
+ {
+ this.Par0 = Par0;
+ this.Index = Index;
+ this.Par1 = Par1;
+ }
- public void JoinP()
- {
- Par0.SetJointP(Index, Par1);
- }
+ public void JoinP()
+ {
+ Par0.SetJointP(Index, Par1);
+ }
- public void JoinPA()
- {
- Par0.SetJointPA(Index, Par1);
- }
+ public void JoinPA()
+ {
+ Par0.SetJointPA(Index, Par1);
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/JointD.cs b/2DGAMELIB/_2DGAMELIB/JointD.cs
index a6fcd0a..5608805 100644
--- a/2DGAMELIB/_2DGAMELIB/JointD.cs
+++ b/2DGAMELIB/_2DGAMELIB/JointD.cs
@@ -1,72 +1,73 @@
using System;
using System.Collections.Generic;
-namespace _2DGAMELIB;
-
-[Serializable]
-public class JointD
+namespace _2DGAMELIB
{
- public Difs Difs0;
+ [Serializable]
+ public class JointD
+ {
+ public Difs Difs0;
- public List Path0;
+ public List Path0;
- public int Index;
+ public int Index;
- public Difs Difs1;
+ public Difs Difs1;
- public JointD(Difs Difs0, Par Par0, int Index, Difs Difs1)
- {
- this.Difs0 = Difs0;
- Path0 = Par0.GetPath();
- this.Index = Index;
- this.Difs1 = Difs1;
- }
+ public JointD(Difs Difs0, Par Par0, int Index, Difs Difs1)
+ {
+ this.Difs0 = Difs0;
+ Path0 = Par0.GetPath();
+ this.Index = Index;
+ this.Difs1 = Difs1;
+ }
- public JointD(Difs Difs1)
- {
- this.Difs1 = Difs1;
- }
+ public JointD(Difs Difs1)
+ {
+ this.Difs1 = Difs1;
+ }
- public void JoinP()
- {
- Difs0.Current.GetPar(Path0).SetJointP(Index, Difs1.CurJoinRoot);
- Difs1.JoinPA();
- }
+ public void JoinP()
+ {
+ Difs0.Current.GetPar(Path0).SetJointP(Index, Difs1.CurJoinRoot);
+ Difs1.JoinPA();
+ }
- public void JoinPA()
- {
- Difs0.Current.GetPar(Path0).SetJointPA(Index, Difs1.CurJoinRoot);
- Difs1.JoinPA();
- }
+ public void JoinPA()
+ {
+ Difs0.Current.GetPar(Path0).SetJointPA(Index, Difs1.CurJoinRoot);
+ Difs1.JoinPA();
+ }
- public void JoinPall()
- {
- foreach (Par item in Difs1.EnumJoinRoot)
- {
- Difs0.Current.GetPar(Path0).SetJointP(Index, item);
- }
- foreach (Pars item2 in Difs1.EnumAllPars())
- {
- Difs1.JoinPA(item2);
- }
- }
+ public void JoinPall()
+ {
+ foreach (Par item in Difs1.EnumJoinRoot)
+ {
+ Difs0.Current.GetPar(Path0).SetJointP(Index, item);
+ }
+ foreach (Pars item2 in Difs1.EnumAllPars())
+ {
+ Difs1.JoinPA(item2);
+ }
+ }
- public void JoinPAall()
- {
- foreach (Par item in Difs1.EnumJoinRoot)
- {
- Difs0.Current.GetPar(Path0).SetJointPA(Index, item);
- }
- foreach (Pars item2 in Difs1.EnumAllPars())
- {
- Difs1.JoinPA(item2);
- }
- }
+ public void JoinPAall()
+ {
+ foreach (Par item in Difs1.EnumJoinRoot)
+ {
+ Difs0.Current.GetPar(Path0).SetJointPA(Index, item);
+ }
+ foreach (Pars item2 in Difs1.EnumAllPars())
+ {
+ Difs1.JoinPA(item2);
+ }
+ }
- public void Set(JointS 接続元)
- {
- Difs0 = 接続元.Difs;
- Path0 = 接続元.Path;
- Index = 接続元.Index;
- }
+ public void Set(JointS 接続元)
+ {
+ Difs0 = 接続元.Difs;
+ Path0 = 接続元.Path;
+ Index = 接続元.Index;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Joints.cs b/2DGAMELIB/_2DGAMELIB/Joints.cs
index 69005a5..070920b 100644
--- a/2DGAMELIB/_2DGAMELIB/Joints.cs
+++ b/2DGAMELIB/_2DGAMELIB/Joints.cs
@@ -1,46 +1,47 @@
using System;
using System.Collections.Generic;
-namespace _2DGAMELIB;
-
-[Serializable]
-public class Joints
+namespace _2DGAMELIB
{
- public List Joins = new List();
+ [Serializable]
+ public class Joints
+ {
+ public List Joins = new List();
- public void JoinP()
- {
- foreach (Joint join in Joins)
- {
- join.JoinP();
- }
- }
+ public void JoinP()
+ {
+ foreach (Joint join in Joins)
+ {
+ join.JoinP();
+ }
+ }
- public void JoinPA()
- {
- foreach (Joint join in Joins)
- {
- join.JoinPA();
- }
- }
-}
-[Serializable]
-public class JointS
-{
- public Difs Difs;
+ public void JoinPA()
+ {
+ foreach (Joint join in Joins)
+ {
+ join.JoinPA();
+ }
+ }
+ }
+ [Serializable]
+ public class JointS
+ {
+ public Difs Difs;
- public List Path;
+ public List Path;
- public int Index;
+ public int Index;
- public JointS()
- {
- }
+ public JointS()
+ {
+ }
- public JointS(Difs Difs, Par Par, int Index)
- {
- this.Difs = Difs;
- Path = Par.GetPath();
- this.Index = Index;
- }
+ public JointS(Difs Difs, Par Par, int Index)
+ {
+ this.Difs = Difs;
+ Path = Par.GetPath();
+ this.Index = Index;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/JointsD.cs b/2DGAMELIB/_2DGAMELIB/JointsD.cs
index fc0345b..b84db96 100644
--- a/2DGAMELIB/_2DGAMELIB/JointsD.cs
+++ b/2DGAMELIB/_2DGAMELIB/JointsD.cs
@@ -1,42 +1,43 @@
using System;
using System.Collections.Generic;
-namespace _2DGAMELIB;
-
-[Serializable]
-public class JointsD
+namespace _2DGAMELIB
{
- public List Joins = new List();
+ [Serializable]
+ public class JointsD
+ {
+ public List Joins = new List();
- public void JoinP()
- {
- foreach (JointD join in Joins)
- {
- join.JoinP();
- }
- }
+ public void JoinP()
+ {
+ foreach (JointD join in Joins)
+ {
+ join.JoinP();
+ }
+ }
- public void JoinPA()
- {
- foreach (JointD join in Joins)
- {
- join.JoinPA();
- }
- }
+ public void JoinPA()
+ {
+ foreach (JointD join in Joins)
+ {
+ join.JoinPA();
+ }
+ }
- public void JoinPall()
- {
- foreach (JointD join in Joins)
- {
- join.JoinPall();
- }
- }
+ public void JoinPall()
+ {
+ foreach (JointD join in Joins)
+ {
+ join.JoinPall();
+ }
+ }
- public void JoinPAall()
- {
- foreach (JointD join in Joins)
- {
- join.JoinPAall();
- }
- }
+ public void JoinPAall()
+ {
+ foreach (JointD join in Joins)
+ {
+ join.JoinPAall();
+ }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Lab.cs b/2DGAMELIB/_2DGAMELIB/Lab.cs
index d6ec888..3473611 100644
--- a/2DGAMELIB/_2DGAMELIB/Lab.cs
+++ b/2DGAMELIB/_2DGAMELIB/Lab.cs
@@ -1,181 +1,182 @@
using System;
using System.Drawing;
-namespace _2DGAMELIB;
-
-public class Lab
+namespace _2DGAMELIB
{
- private ParT parT;
+ public class Lab
+ {
+ private ParT parT;
- private Med Med;
+ private Med Med;
- private Are Are;
+ private Are Are;
- private double Width;
+ private double Width;
- private bool Input;
+ private bool Input;
- private double Min;
+ private double Min;
- public ParT ParT => parT;
+ public ParT ParT => parT;
- public string Text
- {
- get
- {
- return parT.Text;
- }
- set
- {
+ public string Text
+ {
+ get
+ {
+ return parT.Text;
+ }
+ set
+ {
+ //TODO fix?
+ //if (!Med.BaseControl.Contains(tb))
+ {
+ SetText(value);
+ }
+ }
+ }
+
+ private void SetText(string Text)
+ {
+ parT.Text = Text;
+ SetRect();
+ }
+
+ public Lab(Med Med, Are Are, string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input)
+ {
+ //Note: Input is always false
+ Setting(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input);
+ }
+
+ public Lab(Med Med, Are Are, string Name, Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, Color TextColor, Color ShadColor, Color BackColor, Color FramColor, bool Input)
+ {
+ Setting(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input);
+ }
+
+ private void Setting(Med Med, Are Are, string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input)
+ {
+ this.Med = Med;
+ this.Are = Are;
+ this.Width = Width;
+ this.Input = Input;
+
+ Out[] array = new Out[1] { Shas.Get正方形() };
+ if (FramColor == Color.Empty || FramColor == Color.Transparent)
+ {
+ array.OutlineFalse();
+ }
+ parT = new ParT
+ {
+ Tag = Name,
+ InitializeOP = array,
+ BasePointBase = array[0].ps[0],
+ PositionBase = Position,
+ SizeBase = Size,
+ Closed = true,
+ BrushColor = BackColor,
+ PenColor = FramColor,
+ Font = Font,
+ FontSize = TextSize,
+ TextColor = TextColor,
+ Text = "A"
+ };
+ if (ShadColor != Color.Empty)
+ {
+ parT.ShadBrush = new SolidBrush(ShadColor);
+ }
+ SetRect();
+ Min = parT.RectSize.Y;
+ SetText(Text);
+ }
+
+ private void Lab_Resize(object sender, EventArgs e)
+ {
//TODO fix?
- //if (!Med.BaseControl.Contains(tb))
- {
- SetText(value);
- }
- }
- }
+ //Med.BaseControl.Controls.Remove(tb);
+ //SetText(tb.Text);
+ }
- private void SetText(string Text)
- {
- parT.Text = Text;
- SetRect();
- }
+ public void SetHitColor(Med Med)
+ {
+ if (parT.HitColor != Color.Transparent)
+ {
+ Med.RemUniqueColor(parT.HitColor);
+ }
+ parT.HitColor = Med.GetUniqueColor();
+ }
- public Lab(Med Med, Are Are, string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input)
- {
- //Note: Input is always false
- Setting(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input);
- }
+ private void SetRect()
+ {
+ if (!string.IsNullOrEmpty(parT.Text))
+ {
+ parT.RectSize = new Vector2D(Width, 10.0);
+ Vector2D_2 stringRect = parT.GetStringRect(Are.DisUnit, Are.GD);
+ double x = ((stringRect.v2.X > Min) ? stringRect.v2.X : Min) + 0.07;
+ parT.RectSize = new Vector2D(x, stringRect.v2.Y);
+ }
+ else
+ {
+ double x2 = Min + 0.07;
+ parT.RectSize = new Vector2D(x2, Min);
+ }
+ parT.OP[0].ps[0] = new Vector2D(0.0, 0.0);
+ parT.OP[0].ps[1] = new Vector2D(parT.RectSize.X, 0.0);
+ parT.OP[0].ps[2] = new Vector2D(parT.RectSize.X, parT.RectSize.Y);
+ parT.OP[0].ps[3] = new Vector2D(0.0, parT.RectSize.Y);
+ }
- public Lab(Med Med, Are Are, string Name, Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, Color TextColor, Color ShadColor, Color BackColor, Color FramColor, bool Input)
- {
- Setting(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input);
- }
+ private void SetRectT()
+ {
+ /*
+ double resMag = Med.ResMag;
+ Vector2D vector2D = (parT.Position + Are.GetPosition()) * Med.Unit / resMag + Med.ResVector;
- private void Setting(Med Med, Are Are, string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input)
- {
- this.Med = Med;
- this.Are = Are;
- this.Width = Width;
- this.Input = Input;
+ tb.Location = new Point((int)vector2D.X - 1, (int)vector2D.Y - 1);
+ double num = parT.Size * Med.Unit;
- Out[] array = new Out[1] { Shas.Get正方形() };
- if (FramColor == Color.Empty || FramColor == Color.Transparent)
- {
- array.OutlineFalse();
- }
- parT = new ParT
- {
- Tag = Name,
- InitializeOP = array,
- BasePointBase = array[0].ps[0],
- PositionBase = Position,
- SizeBase = Size,
- Closed = true,
- BrushColor = BackColor,
- PenColor = FramColor,
- Font = Font,
- FontSize = TextSize,
- TextColor = TextColor,
- Text = "A"
- };
- if (ShadColor != Color.Empty)
- {
- parT.ShadBrush = new SolidBrush(ShadColor);
- }
- SetRect();
- Min = parT.RectSize.Y;
- SetText(Text);
- }
+ if (tb.Font != null)
+ {
+ tb.Font.Dispose();
+ }
+ tb.Font = new Font(parT.Font.FontFamily, (float)(parT.FontSize * num / resMag));
+ Vector2D vector2D2 = parT.RectSize * num / resMag;
+ tb.Size = new Size((int)(vector2D2.X + 2.0), (int)(vector2D2.Y + 10.0));*/
+ }
- private void Lab_Resize(object sender, EventArgs e)
- {
- //TODO fix?
- //Med.BaseControl.Controls.Remove(tb);
- //SetText(tb.Text);
- }
-
- public void SetHitColor(Med Med)
- {
- if (parT.HitColor != Color.Transparent)
- {
- Med.RemUniqueColor(parT.HitColor);
- }
- parT.HitColor = Med.GetUniqueColor();
- }
-
- private void SetRect()
- {
- if (!string.IsNullOrEmpty(parT.Text))
- {
- parT.RectSize = new Vector2D(Width, 10.0);
- Vector2D_2 stringRect = parT.GetStringRect(Are.DisUnit, Are.GD);
- double x = ((stringRect.v2.X > Min) ? stringRect.v2.X : Min) + 0.07;
- parT.RectSize = new Vector2D(x, stringRect.v2.Y);
- }
- else
- {
- double x2 = Min + 0.07;
- parT.RectSize = new Vector2D(x2, Min);
- }
- parT.OP[0].ps[0] = new Vector2D(0.0, 0.0);
- parT.OP[0].ps[1] = new Vector2D(parT.RectSize.X, 0.0);
- parT.OP[0].ps[2] = new Vector2D(parT.RectSize.X, parT.RectSize.Y);
- parT.OP[0].ps[3] = new Vector2D(0.0, parT.RectSize.Y);
- }
-
- private void SetRectT()
- {
- /*
- double resMag = Med.ResMag;
- Vector2D vector2D = (parT.Position + Are.GetPosition()) * Med.Unit / resMag + Med.ResVector;
-
- tb.Location = new Point((int)vector2D.X - 1, (int)vector2D.Y - 1);
- double num = parT.Size * Med.Unit;
-
- if (tb.Font != null)
- {
- tb.Font.Dispose();
- }
- tb.Font = new Font(parT.Font.FontFamily, (float)(parT.FontSize * num / resMag));
- Vector2D vector2D2 = parT.RectSize * num / resMag;
- tb.Size = new Size((int)(vector2D2.X + 2.0), (int)(vector2D2.Y + 10.0));*/
- }
-
- public bool Double(ref Color HitColor)
- {
- //TODO fix?
- //if (Input && parT.HitColor == HitColor && !Med.BaseControl.Controls.Contains(tb))
- /*{
- tb.Text = parT.Text;
- parT.Text = "";
- SetRectT();
- //Med.BaseControl.Controls.Add(tb);
- tb.SelectAll();
- tb.Focus();
- tb.BringToFront();
- return true;
- }*/
- return false;
- }
-
- public void Click(ref Color HitColor)
- {
- //TODO fix?
- /*if (Input && parT.HitColor != HitColor && Med.BaseControl.Controls.Contains(tb))
- {
- //Med.BaseControl.Controls.Remove(tb);
- SetText(tb.Text);
- }*/
- }
-
- public void Dispose()
- {
- parT.Dispose();
- if (Input)
- {
+ public bool Double(ref Color HitColor)
+ {
//TODO fix?
- //((Control)Med.BaseControl).Resize -= Lab_Resize;
- }
- }
+ //if (Input && parT.HitColor == HitColor && !Med.BaseControl.Controls.Contains(tb))
+ /*{
+ tb.Text = parT.Text;
+ parT.Text = "";
+ SetRectT();
+ //Med.BaseControl.Controls.Add(tb);
+ tb.SelectAll();
+ tb.Focus();
+ tb.BringToFront();
+ return true;
+ }*/
+ return false;
+ }
+
+ public void Click(ref Color HitColor)
+ {
+ //TODO fix?
+ /*if (Input && parT.HitColor != HitColor && Med.BaseControl.Controls.Contains(tb))
+ {
+ //Med.BaseControl.Controls.Remove(tb);
+ SetText(tb.Text);
+ }*/
+ }
+
+ public void Dispose()
+ {
+ parT.Dispose();
+ if (Input)
+ {
+ //TODO fix?
+ //((Control)Med.BaseControl).Resize -= Lab_Resize;
+ }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Labs.cs b/2DGAMELIB/_2DGAMELIB/Labs.cs
index cd48802..5c51fc8 100644
--- a/2DGAMELIB/_2DGAMELIB/Labs.cs
+++ b/2DGAMELIB/_2DGAMELIB/Labs.cs
@@ -1,79 +1,80 @@
using System.Collections.Generic;
using System.Drawing;
-namespace _2DGAMELIB;
-
-public class Labs
+namespace _2DGAMELIB
{
- private OrderedDictionary labs = new OrderedDictionary();
+ public class Labs
+ {
+ private OrderedDictionary labs = new OrderedDictionary();
- private Med Med;
+ private Med Med;
- private Are Are;
+ private Are Are;
- public Lab this[string Name] => labs[Name];
+ public Lab this[string Name] => labs[Name];
- public Labs(Med Med, Are Are)
- {
- this.Med = Med;
- this.Are = Are;
- }
+ public Labs(Med Med, Are Are)
+ {
+ this.Med = Med;
+ this.Are = Are;
+ }
- public void Add(string Name, Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, Color TextColor, Color ShadColor, Color BackColor, Color FramColor, bool Input)
- {
- labs.Add(Name, new Lab(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input));
- }
+ public void Add(string Name, Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, Color TextColor, Color ShadColor, Color BackColor, Color FramColor, bool Input)
+ {
+ labs.Add(Name, new Lab(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input));
+ }
- public void Add(string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input)
- {
- labs.Add(Name, new Lab(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input));
- }
+ public void Add(string Name, ref Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor, ref Color FramColor, bool Input)
+ {
+ labs.Add(Name, new Lab(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input));
+ }
- public void Double(ref Color HitColor)
- {
- using IEnumerator enumerator = labs.Values.GetEnumerator();
- while (enumerator.MoveNext() && !enumerator.Current.Double(ref HitColor))
- {
- }
- }
+ public void Double(ref Color HitColor)
+ {
+ using IEnumerator enumerator = labs.Values.GetEnumerator();
+ while (enumerator.MoveNext() && !enumerator.Current.Double(ref HitColor))
+ {
+ }
+ }
- public void Click(ref Color HitColor)
- {
- foreach (Lab value in labs.Values)
- {
- value.Click(ref HitColor);
- }
- }
+ public void Click(ref Color HitColor)
+ {
+ foreach (Lab value in labs.Values)
+ {
+ value.Click(ref HitColor);
+ }
+ }
- public void SetHitColor(Med Med)
- {
- foreach (Lab value in labs.Values)
- {
- value.SetHitColor(Med);
- }
- }
+ public void SetHitColor(Med Med)
+ {
+ foreach (Lab value in labs.Values)
+ {
+ value.SetHitColor(Med);
+ }
+ }
- public void Draw(Are Are)
- {
- foreach (Lab value in labs.Values)
- {
- Are.Draw(value.ParT);
- }
- }
+ public void Draw(Are Are)
+ {
+ foreach (Lab value in labs.Values)
+ {
+ Are.Draw(value.ParT);
+ }
+ }
- public void Draw(AreM AreM)
- {
- foreach (Lab value in labs.Values)
- {
- AreM.Draw(value.ParT);
- }
- }
+ public void Draw(AreM AreM)
+ {
+ foreach (Lab value in labs.Values)
+ {
+ AreM.Draw(value.ParT);
+ }
+ }
- public void Dispose()
- {
- foreach (Lab value in labs.Values)
- {
- value.Dispose();
- }
- }
+ public void Dispose()
+ {
+ foreach (Lab value in labs.Values)
+ {
+ value.Dispose();
+ }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Math.cs b/2DGAMELIB/_2DGAMELIB/Math.cs
index 6763424..a4d0131 100644
--- a/2DGAMELIB/_2DGAMELIB/Math.cs
+++ b/2DGAMELIB/_2DGAMELIB/Math.cs
@@ -1,98 +1,99 @@
using System;
-namespace _2DGAMELIB;
-
-//TODO remove these...
-public static class Math
+namespace _2DGAMELIB
{
- public static double RoundDown(this double Value, int Digits)
+ //TODO remove these...
+ public static class Math
{
- double num = System.Math.Pow(10.0, Digits);
- if (!(Value > 0.0))
+ public static double RoundDown(this double Value, int Digits)
{
- return System.Math.Ceiling(Value * num) / num;
+ double num = System.Math.Pow(10.0, Digits);
+ if (!(Value > 0.0))
+ {
+ return System.Math.Ceiling(Value * num) / num;
+ }
+ return System.Math.Floor(Value * num) / num;
}
- return System.Math.Floor(Value * num) / num;
- }
- public static double Inverse(this double Rate)
- {
- if (Rate == 0.0)
+ public static double Inverse(this double Rate)
{
- return 1.0;
+ if (Rate == 0.0)
+ {
+ return 1.0;
+ }
+ return (double)System.Math.Sign(Rate) - Rate;
}
- return (double)System.Math.Sign(Rate) - Rate;
- }
- public static double Reciprocal(this double Rate)
- {
- if (Rate == 0.0)
+ public static double Reciprocal(this double Rate)
{
- return 1.0;
+ if (Rate == 0.0)
+ {
+ return 1.0;
+ }
+ return 1.0 / Rate;
}
- return 1.0 / Rate;
+ public static double ToRadian(this double Degree)
+ {
+ return System.Math.PI * Degree / 180.0;
+ }
+ public static double ToDegree(this double Radian)
+ {
+ return Radian * 180.0 / System.Math.PI;
+ }
+ public static double Pow(this double x, double n)
+ {
+ return System.Math.Pow(x, n);
+ }
+
+ public static double Sin(this double θ)
+ {
+ return System.Math.Sin(θ);
+ }
+
+ public static double Abs(this double x)
+ {
+ return System.Math.Abs(x);
+ }
+
+ public static int Abs(this int x)
+ {
+ return System.Math.Abs(x);
+ }
+
+ public static int Sign(this double x)
+ {
+ return System.Math.Sign(x);
+ }
+
+ public static int Sign(this int x)
+ {
+ return System.Math.Sign(x);
+ }
+
+ public static double Sqrt(this double x)
+ {
+ return System.Math.Sqrt(x);
+ }
+
+ public static double Max(this double a, double b)
+ {
+ return System.Math.Max(a, b);
+ }
+
+ public static int Clamp(this int Value, int Min, int Max)
+ {
+ return System.Math.Min(Max, System.Math.Max(Min, Value));
+ }
+
+ public static double Clamp(this double Value, double Min, double Max)
+ {
+ return System.Math.Min(Max, System.Math.Max(Min, Value));
+ }
+
+ public static int Limit(this int Value, int Sta, int Les)
+ {
+ return System.Math.Min(Les-1, System.Math.Max(Sta, Value));
+ }
+
}
- public static double ToRadian(this double Degree)
- {
- return System.Math.PI * Degree / 180.0;
- }
- public static double ToDegree(this double Radian)
- {
- return Radian * 180.0 / System.Math.PI;
- }
- public static double Pow(this double x, double n)
- {
- return System.Math.Pow(x, n);
- }
-
- public static double Sin(this double θ)
- {
- return System.Math.Sin(θ);
- }
-
- public static double Abs(this double x)
- {
- return System.Math.Abs(x);
- }
-
- public static int Abs(this int x)
- {
- return System.Math.Abs(x);
- }
-
- public static int Sign(this double x)
- {
- return System.Math.Sign(x);
- }
-
- public static int Sign(this int x)
- {
- return System.Math.Sign(x);
- }
-
- public static double Sqrt(this double x)
- {
- return System.Math.Sqrt(x);
- }
-
- public static double Max(this double a, double b)
- {
- return System.Math.Max(a, b);
- }
-
- public static int Clamp(this int Value, int Min, int Max)
- {
- return System.Math.Min(Max, System.Math.Max(Min, Value));
- }
-
- public static double Clamp(this double Value, double Min, double Max)
- {
- return System.Math.Min(Max, System.Math.Max(Min, Value));
- }
-
- public static int Limit(this int Value, int Sta, int Les)
- {
- return System.Math.Min(Les-1, System.Math.Max(Sta, Value));
- }
-
}
diff --git a/2DGAMELIB/_2DGAMELIB/Matrix.cs b/2DGAMELIB/_2DGAMELIB/Matrix.cs
index be04205..17aa466 100644
--- a/2DGAMELIB/_2DGAMELIB/Matrix.cs
+++ b/2DGAMELIB/_2DGAMELIB/Matrix.cs
@@ -1,154 +1,155 @@
using System;
-namespace _2DGAMELIB;
-
-public static class Matrix
+namespace _2DGAMELIB
{
- public static MatrixD RotationZ(this double angle)
- {
- MatrixD result = default(MatrixD);
- result.M11 = System.Math.Cos(angle);
- result.M12 = System.Math.Sin(angle);
- result.M13 = 0.0;
- result.M14 = 0.0;
- result.M21 = 0.0 - result.M12;
- result.M22 = result.M11;
- result.M23 = 0.0;
- result.M24 = 0.0;
- result.M31 = 0.0;
- result.M32 = 0.0;
- result.M33 = 1.0;
- result.M34 = 0.0;
- result.M41 = 0.0;
- result.M42 = 0.0;
- result.M43 = 0.0;
- result.M44 = 1.0;
- return result;
- }
+ public static class Matrix
+ {
+ public static MatrixD RotationZ(this double angle)
+ {
+ MatrixD result = default(MatrixD);
+ result.M11 = System.Math.Cos(angle);
+ result.M12 = System.Math.Sin(angle);
+ result.M13 = 0.0;
+ result.M14 = 0.0;
+ result.M21 = 0.0 - result.M12;
+ result.M22 = result.M11;
+ result.M23 = 0.0;
+ result.M24 = 0.0;
+ result.M31 = 0.0;
+ result.M32 = 0.0;
+ result.M33 = 1.0;
+ result.M34 = 0.0;
+ result.M41 = 0.0;
+ result.M42 = 0.0;
+ result.M43 = 0.0;
+ result.M44 = 1.0;
+ return result;
+ }
- public static void RotationZ(this double angle, out MatrixD result)
- {
- result.M11 = System.Math.Cos(angle);
- result.M12 = System.Math.Sin(angle);
- result.M13 = 0.0;
- result.M14 = 0.0;
- result.M21 = 0.0 - result.M12;
- result.M22 = result.M11;
- result.M23 = 0.0;
- result.M24 = 0.0;
- result.M31 = 0.0;
- result.M32 = 0.0;
- result.M33 = 1.0;
- result.M34 = 0.0;
- result.M41 = 0.0;
- result.M42 = 0.0;
- result.M43 = 0.0;
- result.M44 = 1.0;
- }
+ public static void RotationZ(this double angle, out MatrixD result)
+ {
+ result.M11 = System.Math.Cos(angle);
+ result.M12 = System.Math.Sin(angle);
+ result.M13 = 0.0;
+ result.M14 = 0.0;
+ result.M21 = 0.0 - result.M12;
+ result.M22 = result.M11;
+ result.M23 = 0.0;
+ result.M24 = 0.0;
+ result.M31 = 0.0;
+ result.M32 = 0.0;
+ result.M33 = 1.0;
+ result.M34 = 0.0;
+ result.M41 = 0.0;
+ result.M42 = 0.0;
+ result.M43 = 0.0;
+ result.M44 = 1.0;
+ }
- public static Vector2D TransformCoordinate(this Vector2D coord, MatrixD transform)
- {
- double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
- return new Vector2D((coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num, (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num);
- }
+ public static Vector2D TransformCoordinate(this Vector2D coord, MatrixD transform)
+ {
+ double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
+ return new Vector2D((coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num, (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num);
+ }
- public static Vector2D TransformCoordinate(ref Vector2D coord, ref MatrixD transform)
- {
- double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
- return new Vector2D((coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num, (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num);
- }
+ public static Vector2D TransformCoordinate(ref Vector2D coord, ref MatrixD transform)
+ {
+ double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
+ return new Vector2D((coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num, (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num);
+ }
- public static void TransformCoordinate(this Vector2D coord, MatrixD transform, out Vector2D result)
- {
- double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
- result.X = (coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num;
- result.Y = (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num;
- }
+ public static void TransformCoordinate(this Vector2D coord, MatrixD transform, out Vector2D result)
+ {
+ double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
+ result.X = (coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num;
+ result.Y = (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num;
+ }
- public static void TransformCoordinate(ref Vector2D coord, ref MatrixD transform, out Vector2D result)
- {
- double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
- result.X = (coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num;
- result.Y = (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num;
- }
+ public static void TransformCoordinate(ref Vector2D coord, ref MatrixD transform, out Vector2D result)
+ {
+ double num = 1.0 / (coord.X * transform.M14 + coord.Y * transform.M24 + transform.M44);
+ result.X = (coord.X * transform.M11 + coord.Y * transform.M21 + transform.M41) * num;
+ result.Y = (coord.X * transform.M12 + coord.Y * transform.M22 + transform.M42) * num;
+ }
- public static Vector2D[] TransformCoordinate(this Vector2D[] coords, MatrixD transform)
- {
- int num = coords.Length;
- Vector2D[] array = new Vector2D[num];
- for (int i = 0; i < num; i++)
- {
- double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
- array[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
- array[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
- }
- return array;
- }
+ public static Vector2D[] TransformCoordinate(this Vector2D[] coords, MatrixD transform)
+ {
+ int num = coords.Length;
+ Vector2D[] array = new Vector2D[num];
+ for (int i = 0; i < num; i++)
+ {
+ double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
+ array[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
+ array[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
+ }
+ return array;
+ }
- public static Vector2D[] TransformCoordinate(this Vector2D[] coords, ref MatrixD transform)
- {
- int num = coords.Length;
- Vector2D[] array = new Vector2D[num];
- for (int i = 0; i < num; i++)
- {
- double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
- array[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
- array[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
- }
- return array;
- }
+ public static Vector2D[] TransformCoordinate(this Vector2D[] coords, ref MatrixD transform)
+ {
+ int num = coords.Length;
+ Vector2D[] array = new Vector2D[num];
+ for (int i = 0; i < num; i++)
+ {
+ double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
+ array[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
+ array[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
+ }
+ return array;
+ }
- public static void TransformCoordinate(this Vector2D[] coords, MatrixD transform, out Vector2D[] results)
- {
- int num = coords.Length;
- results = new Vector2D[num];
- for (int i = 0; i < num; i++)
- {
- double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
- results[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
- results[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
- }
- }
+ public static void TransformCoordinate(this Vector2D[] coords, MatrixD transform, out Vector2D[] results)
+ {
+ int num = coords.Length;
+ results = new Vector2D[num];
+ for (int i = 0; i < num; i++)
+ {
+ double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
+ results[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
+ results[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
+ }
+ }
- public static void TransformCoordinate(this Vector2D[] coords, ref MatrixD transform, out Vector2D[] results)
- {
- int num = coords.Length;
- results = new Vector2D[num];
- for (int i = 0; i < num; i++)
- {
- double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
- results[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
- results[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
- }
- }
+ public static void TransformCoordinate(this Vector2D[] coords, ref MatrixD transform, out Vector2D[] results)
+ {
+ int num = coords.Length;
+ results = new Vector2D[num];
+ for (int i = 0; i < num; i++)
+ {
+ double num2 = 1.0 / (coords[i].X * transform.M14 + coords[i].Y * transform.M24 + transform.M44);
+ results[i].X = (coords[i].X * transform.M11 + coords[i].Y * transform.M21 + transform.M41) * num2;
+ results[i].Y = (coords[i].X * transform.M12 + coords[i].Y * transform.M22 + transform.M42) * num2;
+ }
+ }
- public static Vector2D TransformCoordinateBP(this Vector2D coord, Vector2D BasePoint, MatrixD transform)
- {
- Vec.Subtract(ref coord, ref BasePoint, out coord);
- TransformCoordinate(ref coord, ref transform, out var result);
- Vec.Add(ref result, ref BasePoint, out result);
- return result;
- }
+ public static Vector2D TransformCoordinateBP(this Vector2D coord, Vector2D BasePoint, MatrixD transform)
+ {
+ Vec.Subtract(ref coord, ref BasePoint, out coord);
+ TransformCoordinate(ref coord, ref transform, out var result);
+ Vec.Add(ref result, ref BasePoint, out result);
+ return result;
+ }
- public static Vector2D TransformCoordinateBP(ref Vector2D coord, ref Vector2D BasePoint, ref MatrixD transform)
- {
- Vec.Subtract(ref coord, ref BasePoint, out var r);
- TransformCoordinate(ref r, ref transform, out var result);
- Vec.Add(ref result, ref BasePoint, out result);
- return result;
- }
+ public static Vector2D TransformCoordinateBP(ref Vector2D coord, ref Vector2D BasePoint, ref MatrixD transform)
+ {
+ Vec.Subtract(ref coord, ref BasePoint, out var r);
+ TransformCoordinate(ref r, ref transform, out var result);
+ Vec.Add(ref result, ref BasePoint, out result);
+ return result;
+ }
- public static void TransformCoordinateBP(this Vector2D coord, Vector2D BasePoint, MatrixD transform, out Vector2D result)
- {
- Vec.Subtract(ref coord, ref BasePoint, out coord);
- TransformCoordinate(ref coord, ref transform, out result);
- Vec.Add(ref result, ref BasePoint, out result);
- }
+ public static void TransformCoordinateBP(this Vector2D coord, Vector2D BasePoint, MatrixD transform, out Vector2D result)
+ {
+ Vec.Subtract(ref coord, ref BasePoint, out coord);
+ TransformCoordinate(ref coord, ref transform, out result);
+ Vec.Add(ref result, ref BasePoint, out result);
+ }
- public static void TransformCoordinateBP(ref Vector2D coord, ref Vector2D BasePoint, ref MatrixD transform, out Vector2D result)
- {
- Vec.Subtract(ref coord, ref BasePoint, out var r);
- TransformCoordinate(ref r, ref transform, out result);
- Vec.Add(ref result, ref BasePoint, out result);
- }
+ public static void TransformCoordinateBP(ref Vector2D coord, ref Vector2D BasePoint, ref MatrixD transform, out Vector2D result)
+ {
+ Vec.Subtract(ref coord, ref BasePoint, out var r);
+ TransformCoordinate(ref r, ref transform, out result);
+ Vec.Add(ref result, ref BasePoint, out result);
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/MatrixD.cs b/2DGAMELIB/_2DGAMELIB/MatrixD.cs
index cbbf31f..2fa0bf3 100644
--- a/2DGAMELIB/_2DGAMELIB/MatrixD.cs
+++ b/2DGAMELIB/_2DGAMELIB/MatrixD.cs
@@ -1,587 +1,588 @@
using System;
using System.Globalization;
-namespace _2DGAMELIB;
-
-[Serializable]
-public struct MatrixD
+namespace _2DGAMELIB
{
- public double M11;
+ [Serializable]
+ public struct MatrixD
+ {
+ public double M11;
- public double M12;
+ public double M12;
- public double M13;
+ public double M13;
- public double M14;
+ public double M14;
- public double M21;
+ public double M21;
- public double M22;
+ public double M22;
- public double M23;
+ public double M23;
- public double M24;
+ public double M24;
- public double M31;
+ public double M31;
- public double M32;
+ public double M32;
- public double M33;
+ public double M33;
- public double M34;
+ public double M34;
- public double M41;
+ public double M41;
- public double M42;
+ public double M42;
- public double M43;
+ public double M43;
- public double M44;
+ public double M44;
- public double this[int row, int col]
- {
- get
- {
- switch (row)
- {
- case 0:
- switch (col)
- {
- case 0:
- return M11;
- case 1:
- return M12;
- case 2:
- return M13;
- case 3:
- return M14;
- default:
- error(row, col);
- return 0.0;
- }
- case 1:
- switch (col)
- {
- case 0:
- return M21;
- case 1:
- return M22;
- case 2:
- return M23;
- case 3:
- return M24;
- default:
- error(row, col);
- return 0.0;
- }
- case 2:
- switch (col)
- {
- case 0:
- return M31;
- case 1:
- return M32;
- case 2:
- return M33;
- case 3:
- return M34;
- default:
- error(row, col);
- return 0.0;
- }
- case 3:
- switch (col)
- {
- case 0:
- return M41;
- case 1:
- return M42;
- case 2:
- return M43;
- case 3:
- return M44;
- default:
- error(row, col);
- return 0.0;
- }
- default:
- error(row, col);
- return 0.0;
- }
- }
- set
- {
- switch (row)
- {
- case 0:
- switch (col)
- {
- case 0:
- M11 = value;
- break;
- case 1:
- M12 = value;
- break;
- case 2:
- M13 = value;
- break;
- case 3:
- M14 = value;
- break;
- default:
- error(row, col);
- break;
- }
- break;
- case 1:
- switch (col)
- {
- case 0:
- M21 = value;
- break;
- case 1:
- M22 = value;
- break;
- case 2:
- M23 = value;
- break;
- case 3:
- M24 = value;
- break;
- default:
- error(row, col);
- break;
- }
- break;
- case 2:
- switch (col)
- {
- case 0:
- M31 = value;
- break;
- case 1:
- M32 = value;
- break;
- case 2:
- M33 = value;
- break;
- case 3:
- M34 = value;
- break;
- default:
- error(row, col);
- break;
- }
- break;
- case 3:
- switch (col)
- {
- case 0:
- M41 = value;
- break;
- case 1:
- M42 = value;
- break;
- case 2:
- M43 = value;
- break;
- case 3:
- M44 = value;
- break;
- default:
- error(row, col);
- break;
- }
- break;
- default:
- error(row, col);
- break;
- }
- }
- }
+ public double this[int row, int col]
+ {
+ get
+ {
+ switch (row)
+ {
+ case 0:
+ switch (col)
+ {
+ case 0:
+ return M11;
+ case 1:
+ return M12;
+ case 2:
+ return M13;
+ case 3:
+ return M14;
+ default:
+ error(row, col);
+ return 0.0;
+ }
+ case 1:
+ switch (col)
+ {
+ case 0:
+ return M21;
+ case 1:
+ return M22;
+ case 2:
+ return M23;
+ case 3:
+ return M24;
+ default:
+ error(row, col);
+ return 0.0;
+ }
+ case 2:
+ switch (col)
+ {
+ case 0:
+ return M31;
+ case 1:
+ return M32;
+ case 2:
+ return M33;
+ case 3:
+ return M34;
+ default:
+ error(row, col);
+ return 0.0;
+ }
+ case 3:
+ switch (col)
+ {
+ case 0:
+ return M41;
+ case 1:
+ return M42;
+ case 2:
+ return M43;
+ case 3:
+ return M44;
+ default:
+ error(row, col);
+ return 0.0;
+ }
+ default:
+ error(row, col);
+ return 0.0;
+ }
+ }
+ set
+ {
+ switch (row)
+ {
+ case 0:
+ switch (col)
+ {
+ case 0:
+ M11 = value;
+ break;
+ case 1:
+ M12 = value;
+ break;
+ case 2:
+ M13 = value;
+ break;
+ case 3:
+ M14 = value;
+ break;
+ default:
+ error(row, col);
+ break;
+ }
+ break;
+ case 1:
+ switch (col)
+ {
+ case 0:
+ M21 = value;
+ break;
+ case 1:
+ M22 = value;
+ break;
+ case 2:
+ M23 = value;
+ break;
+ case 3:
+ M24 = value;
+ break;
+ default:
+ error(row, col);
+ break;
+ }
+ break;
+ case 2:
+ switch (col)
+ {
+ case 0:
+ M31 = value;
+ break;
+ case 1:
+ M32 = value;
+ break;
+ case 2:
+ M33 = value;
+ break;
+ case 3:
+ M34 = value;
+ break;
+ default:
+ error(row, col);
+ break;
+ }
+ break;
+ case 3:
+ switch (col)
+ {
+ case 0:
+ M41 = value;
+ break;
+ case 1:
+ M42 = value;
+ break;
+ case 2:
+ M43 = value;
+ break;
+ case 3:
+ M44 = value;
+ break;
+ default:
+ error(row, col);
+ break;
+ }
+ break;
+ default:
+ error(row, col);
+ break;
+ }
+ }
+ }
- public static MatrixD Identity
- {
- get
- {
- MatrixD result = default(MatrixD);
- result.M11 = 1.0;
- result.M22 = 1.0;
- result.M33 = 1.0;
- result.M44 = 1.0;
- return result;
- }
- }
+ public static MatrixD Identity
+ {
+ get
+ {
+ MatrixD result = default(MatrixD);
+ result.M11 = 1.0;
+ result.M22 = 1.0;
+ result.M33 = 1.0;
+ result.M44 = 1.0;
+ return result;
+ }
+ }
- public bool IsIdentity
- {
- get
- {
- if (M11 != 1.0 || M22 != 1.0 || M33 != 1.0 || M44 != 1.0)
- {
- return false;
- }
- if (M12 != 0.0 || M13 != 0.0 || M14 != 0.0 || M21 != 0.0 || M23 != 0.0 || M24 != 0.0 || M31 != 0.0 || M32 != 0.0 || M34 != 0.0 || M41 != 0.0 || M42 != 0.0 || M43 != 0.0)
- {
- return false;
- }
- return true;
- }
- }
+ public bool IsIdentity
+ {
+ get
+ {
+ if (M11 != 1.0 || M22 != 1.0 || M33 != 1.0 || M44 != 1.0)
+ {
+ return false;
+ }
+ if (M12 != 0.0 || M13 != 0.0 || M14 != 0.0 || M21 != 0.0 || M23 != 0.0 || M24 != 0.0 || M31 != 0.0 || M32 != 0.0 || M34 != 0.0 || M41 != 0.0 || M42 != 0.0 || M43 != 0.0)
+ {
+ return false;
+ }
+ return true;
+ }
+ }
- public MatrixD(double M11, double M12, double M13, double M14, double M21, double M22, double M23, double M24, double M31, double M32, double M33, double M34, double M41, double M42, double M43, double M44)
- {
- this.M11 = M11;
- this.M12 = M12;
- this.M13 = M13;
- this.M14 = M14;
- this.M21 = M21;
- this.M22 = M22;
- this.M23 = M23;
- this.M24 = M24;
- this.M31 = M31;
- this.M32 = M32;
- this.M33 = M33;
- this.M34 = M34;
- this.M41 = M41;
- this.M42 = M42;
- this.M43 = M43;
- this.M44 = M44;
- }
+ public MatrixD(double M11, double M12, double M13, double M14, double M21, double M22, double M23, double M24, double M31, double M32, double M33, double M34, double M41, double M42, double M43, double M44)
+ {
+ this.M11 = M11;
+ this.M12 = M12;
+ this.M13 = M13;
+ this.M14 = M14;
+ this.M21 = M21;
+ this.M22 = M22;
+ this.M23 = M23;
+ this.M24 = M24;
+ this.M31 = M31;
+ this.M32 = M32;
+ this.M33 = M33;
+ this.M34 = M34;
+ this.M41 = M41;
+ this.M42 = M42;
+ this.M43 = M43;
+ this.M44 = M44;
+ }
- private void error(int row, int col)
- {
- if (row < 0 || row > 3)
- {
- throw new ArgumentOutOfRangeException("row", "Rows and columns for matrices run from 0 to 3, inclusive.");
- }
- if (col < 0 || col > 3)
- {
- throw new ArgumentOutOfRangeException("col", "Rows and columns for matrices run from 0 to 3, inclusive.");
- }
- }
+ private void error(int row, int col)
+ {
+ if (row < 0 || row > 3)
+ {
+ throw new ArgumentOutOfRangeException("row", "Rows and columns for matrices run from 0 to 3, inclusive.");
+ }
+ if (col < 0 || col > 3)
+ {
+ throw new ArgumentOutOfRangeException("col", "Rows and columns for matrices run from 0 to 3, inclusive.");
+ }
+ }
- public Vector4D GetRow(int row)
- {
- return new Vector4D(this[row, 0], this[row, 1], this[row, 2], this[row, 3]);
- }
+ public Vector4D GetRow(int row)
+ {
+ return new Vector4D(this[row, 0], this[row, 1], this[row, 2], this[row, 3]);
+ }
- public void SetRow(int row, Vector4D value)
- {
- this[row, 0] = value.X;
- this[row, 1] = value.Y;
- this[row, 2] = value.Z;
- this[row, 3] = value.W;
- }
+ public void SetRow(int row, Vector4D value)
+ {
+ this[row, 0] = value.X;
+ this[row, 1] = value.Y;
+ this[row, 2] = value.Z;
+ this[row, 3] = value.W;
+ }
- public void SetRow(int row, ref Vector4D value)
- {
- this[row, 0] = value.X;
- this[row, 1] = value.Y;
- this[row, 2] = value.Z;
- this[row, 3] = value.W;
- }
+ public void SetRow(int row, ref Vector4D value)
+ {
+ this[row, 0] = value.X;
+ this[row, 1] = value.Y;
+ this[row, 2] = value.Z;
+ this[row, 3] = value.W;
+ }
- public Vector4D GetCol(int column)
- {
- return new Vector4D(this[0, column], this[1, column], this[2, column], this[3, column]);
- }
+ public Vector4D GetCol(int column)
+ {
+ return new Vector4D(this[0, column], this[1, column], this[2, column], this[3, column]);
+ }
- public void SetCol(int column, Vector4D value)
- {
- this[0, column] = value.X;
- this[1, column] = value.Y;
- this[2, column] = value.Z;
- this[3, column] = value.W;
- }
+ public void SetCol(int column, Vector4D value)
+ {
+ this[0, column] = value.X;
+ this[1, column] = value.Y;
+ this[2, column] = value.Z;
+ this[3, column] = value.W;
+ }
- public void SetCol(int column, ref Vector4D value)
- {
- this[0, column] = value.X;
- this[1, column] = value.Y;
- this[2, column] = value.Z;
- this[3, column] = value.W;
- }
+ public void SetCol(int column, ref Vector4D value)
+ {
+ this[0, column] = value.X;
+ this[1, column] = value.Y;
+ this[2, column] = value.Z;
+ this[3, column] = value.W;
+ }
- public double[] ToArray()
- {
- return new double[16]
- {
- M11, M12, M13, M14, M21, M22, M23, M24, M31, M32,
- M33, M34, M41, M42, M43, M44
- };
- }
+ public double[] ToArray()
+ {
+ return new double[16]
+ {
+ M11, M12, M13, M14, M21, M22, M23, M24, M31, M32,
+ M33, M34, M41, M42, M43, M44
+ };
+ }
- public void Invert()
- {
- MatrixD matDIdentity = Dat.MatDIdentity;
- for (int i = 0; i < 4; i++)
- {
- double num = 1.0 / this[i, i];
- for (int j = 0; j < 4; j++)
- {
- this[i, j] *= num;
- matDIdentity[i, j] *= num;
- }
- for (int j = 0; j < 4; j++)
- {
- if (i != j)
- {
- num = this[j, i];
- for (int k = 0; k < 4; k++)
- {
- this[j, k] -= this[i, k] * num;
- matDIdentity[j, k] -= matDIdentity[i, k] * num;
- }
- }
- }
- }
- this = matDIdentity;
- }
+ public void Invert()
+ {
+ MatrixD matDIdentity = Dat.MatDIdentity;
+ for (int i = 0; i < 4; i++)
+ {
+ double num = 1.0 / this[i, i];
+ for (int j = 0; j < 4; j++)
+ {
+ this[i, j] *= num;
+ matDIdentity[i, j] *= num;
+ }
+ for (int j = 0; j < 4; j++)
+ {
+ if (i != j)
+ {
+ num = this[j, i];
+ for (int k = 0; k < 4; k++)
+ {
+ this[j, k] -= this[i, k] * num;
+ matDIdentity[j, k] -= matDIdentity[i, k] * num;
+ }
+ }
+ }
+ }
+ this = matDIdentity;
+ }
- public double Determinant()
- {
- double num = M33 * M44 - M34 * M43;
- double num2 = M32 * M44 - M34 * M42;
- double num3 = M32 * M43 - M33 * M42;
- double num4 = M31 * M44 - M34 * M41;
- double num5 = M31 * M43 - M33 * M41;
- double num6 = M31 * M42 - M32 * M41;
- return M11 * (M22 * num - M23 * num2 + M24 * num3) - M12 * (M21 * num - M23 * num4 + M24 * num5) + M13 * (M21 * num2 - M22 * num4 + M24 * num6) - M14 * (M21 * num3 - M22 * num5 + M23 * num6);
- }
+ public double Determinant()
+ {
+ double num = M33 * M44 - M34 * M43;
+ double num2 = M32 * M44 - M34 * M42;
+ double num3 = M32 * M43 - M33 * M42;
+ double num4 = M31 * M44 - M34 * M41;
+ double num5 = M31 * M43 - M33 * M41;
+ double num6 = M31 * M42 - M32 * M41;
+ return M11 * (M22 * num - M23 * num2 + M24 * num3) - M12 * (M21 * num - M23 * num4 + M24 * num5) + M13 * (M21 * num2 - M22 * num4 + M24 * num6) - M14 * (M21 * num3 - M22 * num5 + M23 * num6);
+ }
- public static MatrixD operator +(MatrixD left, MatrixD right)
- {
- MatrixD result = default(MatrixD);
- result.M11 = left.M11 + right.M11;
- result.M12 = left.M12 + right.M12;
- result.M13 = left.M13 + right.M13;
- result.M14 = left.M14 + right.M14;
- result.M21 = left.M21 + right.M21;
- result.M22 = left.M22 + right.M22;
- result.M23 = left.M23 + right.M23;
- result.M24 = left.M24 + right.M24;
- result.M31 = left.M31 + right.M31;
- result.M32 = left.M32 + right.M32;
- result.M33 = left.M33 + right.M33;
- result.M34 = left.M34 + right.M34;
- result.M41 = left.M41 + right.M41;
- result.M42 = left.M42 + right.M42;
- result.M43 = left.M43 + right.M43;
- result.M44 = left.M44 + right.M44;
- return result;
- }
+ public static MatrixD operator +(MatrixD left, MatrixD right)
+ {
+ MatrixD result = default(MatrixD);
+ result.M11 = left.M11 + right.M11;
+ result.M12 = left.M12 + right.M12;
+ result.M13 = left.M13 + right.M13;
+ result.M14 = left.M14 + right.M14;
+ result.M21 = left.M21 + right.M21;
+ result.M22 = left.M22 + right.M22;
+ result.M23 = left.M23 + right.M23;
+ result.M24 = left.M24 + right.M24;
+ result.M31 = left.M31 + right.M31;
+ result.M32 = left.M32 + right.M32;
+ result.M33 = left.M33 + right.M33;
+ result.M34 = left.M34 + right.M34;
+ result.M41 = left.M41 + right.M41;
+ result.M42 = left.M42 + right.M42;
+ result.M43 = left.M43 + right.M43;
+ result.M44 = left.M44 + right.M44;
+ return result;
+ }
- public static MatrixD operator -(MatrixD left, MatrixD right)
- {
- MatrixD result = default(MatrixD);
- result.M11 = left.M11 - right.M11;
- result.M12 = left.M12 - right.M12;
- result.M13 = left.M13 - right.M13;
- result.M14 = left.M14 - right.M14;
- result.M21 = left.M21 - right.M21;
- result.M22 = left.M22 - right.M22;
- result.M23 = left.M23 - right.M23;
- result.M24 = left.M24 - right.M24;
- result.M31 = left.M31 - right.M31;
- result.M32 = left.M32 - right.M32;
- result.M33 = left.M33 - right.M33;
- result.M34 = left.M34 - right.M34;
- result.M41 = left.M41 - right.M41;
- result.M42 = left.M42 - right.M42;
- result.M43 = left.M43 - right.M43;
- result.M44 = left.M44 - right.M44;
- return result;
- }
+ public static MatrixD operator -(MatrixD left, MatrixD right)
+ {
+ MatrixD result = default(MatrixD);
+ result.M11 = left.M11 - right.M11;
+ result.M12 = left.M12 - right.M12;
+ result.M13 = left.M13 - right.M13;
+ result.M14 = left.M14 - right.M14;
+ result.M21 = left.M21 - right.M21;
+ result.M22 = left.M22 - right.M22;
+ result.M23 = left.M23 - right.M23;
+ result.M24 = left.M24 - right.M24;
+ result.M31 = left.M31 - right.M31;
+ result.M32 = left.M32 - right.M32;
+ result.M33 = left.M33 - right.M33;
+ result.M34 = left.M34 - right.M34;
+ result.M41 = left.M41 - right.M41;
+ result.M42 = left.M42 - right.M42;
+ result.M43 = left.M43 - right.M43;
+ result.M44 = left.M44 - right.M44;
+ return result;
+ }
- public static MatrixD operator -(MatrixD matrix)
- {
- MatrixD result = default(MatrixD);
- result.M11 = 0.0 - matrix.M11;
- result.M12 = 0.0 - matrix.M12;
- result.M13 = 0.0 - matrix.M13;
- result.M14 = 0.0 - matrix.M14;
- result.M21 = 0.0 - matrix.M21;
- result.M22 = 0.0 - matrix.M22;
- result.M23 = 0.0 - matrix.M23;
- result.M24 = 0.0 - matrix.M24;
- result.M31 = 0.0 - matrix.M31;
- result.M32 = 0.0 - matrix.M32;
- result.M33 = 0.0 - matrix.M33;
- result.M34 = 0.0 - matrix.M34;
- result.M41 = 0.0 - matrix.M41;
- result.M42 = 0.0 - matrix.M42;
- result.M43 = 0.0 - matrix.M43;
- result.M44 = 0.0 - matrix.M44;
- return result;
- }
+ public static MatrixD operator -(MatrixD matrix)
+ {
+ MatrixD result = default(MatrixD);
+ result.M11 = 0.0 - matrix.M11;
+ result.M12 = 0.0 - matrix.M12;
+ result.M13 = 0.0 - matrix.M13;
+ result.M14 = 0.0 - matrix.M14;
+ result.M21 = 0.0 - matrix.M21;
+ result.M22 = 0.0 - matrix.M22;
+ result.M23 = 0.0 - matrix.M23;
+ result.M24 = 0.0 - matrix.M24;
+ result.M31 = 0.0 - matrix.M31;
+ result.M32 = 0.0 - matrix.M32;
+ result.M33 = 0.0 - matrix.M33;
+ result.M34 = 0.0 - matrix.M34;
+ result.M41 = 0.0 - matrix.M41;
+ result.M42 = 0.0 - matrix.M42;
+ result.M43 = 0.0 - matrix.M43;
+ result.M44 = 0.0 - matrix.M44;
+ return result;
+ }
- public static MatrixD operator *(MatrixD left, MatrixD right)
- {
- MatrixD result = default(MatrixD);
- result.M11 = left.M11 * right.M11 + left.M12 * right.M21 + left.M13 * right.M31 + left.M14 * right.M41;
- result.M12 = left.M11 * right.M12 + left.M12 * right.M22 + left.M13 * right.M32 + left.M14 * right.M42;
- result.M13 = left.M11 * right.M13 + left.M12 * right.M23 + left.M13 * right.M33 + left.M14 * right.M43;
- result.M14 = left.M11 * right.M14 + left.M12 * right.M24 + left.M13 * right.M34 + left.M14 * right.M44;
- result.M21 = left.M21 * right.M11 + left.M22 * right.M21 + left.M23 * right.M31 + left.M24 * right.M41;
- result.M22 = left.M21 * right.M12 + left.M22 * right.M22 + left.M23 * right.M32 + left.M24 * right.M42;
- result.M23 = left.M21 * right.M13 + left.M22 * right.M23 + left.M23 * right.M33 + left.M24 * right.M43;
- result.M24 = left.M21 * right.M14 + left.M22 * right.M24 + left.M23 * right.M34 + left.M24 * right.M44;
- result.M31 = left.M31 * right.M11 + left.M32 * right.M21 + left.M33 * right.M31 + left.M34 * right.M41;
- result.M32 = left.M31 * right.M12 + left.M32 * right.M22 + left.M33 * right.M32 + left.M34 * right.M42;
- result.M33 = left.M31 * right.M13 + left.M32 * right.M23 + left.M33 * right.M33 + left.M34 * right.M43;
- result.M34 = left.M31 * right.M14 + left.M32 * right.M24 + left.M33 * right.M34 + left.M34 * right.M44;
- result.M41 = left.M41 * right.M11 + left.M42 * right.M21 + left.M43 * right.M31 + left.M44 * right.M41;
- result.M42 = left.M41 * right.M12 + left.M42 * right.M22 + left.M43 * right.M32 + left.M44 * right.M42;
- result.M43 = left.M41 * right.M13 + left.M42 * right.M23 + left.M43 * right.M33 + left.M44 * right.M43;
- result.M44 = left.M41 * right.M14 + left.M42 * right.M24 + left.M43 * right.M34 + left.M44 * right.M44;
- return result;
- }
+ public static MatrixD operator *(MatrixD left, MatrixD right)
+ {
+ MatrixD result = default(MatrixD);
+ result.M11 = left.M11 * right.M11 + left.M12 * right.M21 + left.M13 * right.M31 + left.M14 * right.M41;
+ result.M12 = left.M11 * right.M12 + left.M12 * right.M22 + left.M13 * right.M32 + left.M14 * right.M42;
+ result.M13 = left.M11 * right.M13 + left.M12 * right.M23 + left.M13 * right.M33 + left.M14 * right.M43;
+ result.M14 = left.M11 * right.M14 + left.M12 * right.M24 + left.M13 * right.M34 + left.M14 * right.M44;
+ result.M21 = left.M21 * right.M11 + left.M22 * right.M21 + left.M23 * right.M31 + left.M24 * right.M41;
+ result.M22 = left.M21 * right.M12 + left.M22 * right.M22 + left.M23 * right.M32 + left.M24 * right.M42;
+ result.M23 = left.M21 * right.M13 + left.M22 * right.M23 + left.M23 * right.M33 + left.M24 * right.M43;
+ result.M24 = left.M21 * right.M14 + left.M22 * right.M24 + left.M23 * right.M34 + left.M24 * right.M44;
+ result.M31 = left.M31 * right.M11 + left.M32 * right.M21 + left.M33 * right.M31 + left.M34 * right.M41;
+ result.M32 = left.M31 * right.M12 + left.M32 * right.M22 + left.M33 * right.M32 + left.M34 * right.M42;
+ result.M33 = left.M31 * right.M13 + left.M32 * right.M23 + left.M33 * right.M33 + left.M34 * right.M43;
+ result.M34 = left.M31 * right.M14 + left.M32 * right.M24 + left.M33 * right.M34 + left.M34 * right.M44;
+ result.M41 = left.M41 * right.M11 + left.M42 * right.M21 + left.M43 * right.M31 + left.M44 * right.M41;
+ result.M42 = left.M41 * right.M12 + left.M42 * right.M22 + left.M43 * right.M32 + left.M44 * right.M42;
+ result.M43 = left.M41 * right.M13 + left.M42 * right.M23 + left.M43 * right.M33 + left.M44 * right.M43;
+ result.M44 = left.M41 * right.M14 + left.M42 * right.M24 + left.M43 * right.M34 + left.M44 * right.M44;
+ return result;
+ }
- public static MatrixD operator *(MatrixD left, double right)
- {
- MatrixD result = default(MatrixD);
- result.M11 = left.M11 * right;
- result.M12 = left.M12 * right;
- result.M13 = left.M13 * right;
- result.M14 = left.M14 * right;
- result.M21 = left.M21 * right;
- result.M22 = left.M22 * right;
- result.M23 = left.M23 * right;
- result.M24 = left.M24 * right;
- result.M31 = left.M31 * right;
- result.M32 = left.M32 * right;
- result.M33 = left.M33 * right;
- result.M34 = left.M34 * right;
- result.M41 = left.M41 * right;
- result.M42 = left.M42 * right;
- result.M43 = left.M43 * right;
- result.M44 = left.M44 * right;
- return result;
- }
+ public static MatrixD operator *(MatrixD left, double right)
+ {
+ MatrixD result = default(MatrixD);
+ result.M11 = left.M11 * right;
+ result.M12 = left.M12 * right;
+ result.M13 = left.M13 * right;
+ result.M14 = left.M14 * right;
+ result.M21 = left.M21 * right;
+ result.M22 = left.M22 * right;
+ result.M23 = left.M23 * right;
+ result.M24 = left.M24 * right;
+ result.M31 = left.M31 * right;
+ result.M32 = left.M32 * right;
+ result.M33 = left.M33 * right;
+ result.M34 = left.M34 * right;
+ result.M41 = left.M41 * right;
+ result.M42 = left.M42 * right;
+ result.M43 = left.M43 * right;
+ result.M44 = left.M44 * right;
+ return result;
+ }
- public static MatrixD operator *(double right, MatrixD left)
- {
- MatrixD result = default(MatrixD);
- result.M11 = left.M11 * right;
- result.M12 = left.M12 * right;
- result.M13 = left.M13 * right;
- result.M14 = left.M14 * right;
- result.M21 = left.M21 * right;
- result.M22 = left.M22 * right;
- result.M23 = left.M23 * right;
- result.M24 = left.M24 * right;
- result.M31 = left.M31 * right;
- result.M32 = left.M32 * right;
- result.M33 = left.M33 * right;
- result.M34 = left.M34 * right;
- result.M41 = left.M41 * right;
- result.M42 = left.M42 * right;
- result.M43 = left.M43 * right;
- result.M44 = left.M44 * right;
- return result;
- }
+ public static MatrixD operator *(double right, MatrixD left)
+ {
+ MatrixD result = default(MatrixD);
+ result.M11 = left.M11 * right;
+ result.M12 = left.M12 * right;
+ result.M13 = left.M13 * right;
+ result.M14 = left.M14 * right;
+ result.M21 = left.M21 * right;
+ result.M22 = left.M22 * right;
+ result.M23 = left.M23 * right;
+ result.M24 = left.M24 * right;
+ result.M31 = left.M31 * right;
+ result.M32 = left.M32 * right;
+ result.M33 = left.M33 * right;
+ result.M34 = left.M34 * right;
+ result.M41 = left.M41 * right;
+ result.M42 = left.M42 * right;
+ result.M43 = left.M43 * right;
+ result.M44 = left.M44 * right;
+ return result;
+ }
- public static MatrixD operator /(MatrixD left, MatrixD right)
- {
- MatrixD result = default(MatrixD);
- result.M11 = left.M11 / right.M11;
- result.M12 = left.M12 / right.M12;
- result.M13 = left.M13 / right.M13;
- result.M14 = left.M14 / right.M14;
- result.M21 = left.M21 / right.M21;
- result.M22 = left.M22 / right.M22;
- result.M23 = left.M23 / right.M23;
- result.M24 = left.M24 / right.M24;
- result.M31 = left.M31 / right.M31;
- result.M32 = left.M32 / right.M32;
- result.M33 = left.M33 / right.M33;
- result.M34 = left.M34 / right.M34;
- result.M41 = left.M41 / right.M41;
- result.M42 = left.M42 / right.M42;
- result.M43 = left.M43 / right.M43;
- result.M44 = left.M44 / right.M44;
- return result;
- }
+ public static MatrixD operator /(MatrixD left, MatrixD right)
+ {
+ MatrixD result = default(MatrixD);
+ result.M11 = left.M11 / right.M11;
+ result.M12 = left.M12 / right.M12;
+ result.M13 = left.M13 / right.M13;
+ result.M14 = left.M14 / right.M14;
+ result.M21 = left.M21 / right.M21;
+ result.M22 = left.M22 / right.M22;
+ result.M23 = left.M23 / right.M23;
+ result.M24 = left.M24 / right.M24;
+ result.M31 = left.M31 / right.M31;
+ result.M32 = left.M32 / right.M32;
+ result.M33 = left.M33 / right.M33;
+ result.M34 = left.M34 / right.M34;
+ result.M41 = left.M41 / right.M41;
+ result.M42 = left.M42 / right.M42;
+ result.M43 = left.M43 / right.M43;
+ result.M44 = left.M44 / right.M44;
+ return result;
+ }
- public static MatrixD operator /(MatrixD left, double right)
- {
- MatrixD result = default(MatrixD);
- result.M11 = left.M11 / right;
- result.M12 = left.M12 / right;
- result.M13 = left.M13 / right;
- result.M14 = left.M14 / right;
- result.M21 = left.M21 / right;
- result.M22 = left.M22 / right;
- result.M23 = left.M23 / right;
- result.M24 = left.M24 / right;
- result.M31 = left.M31 / right;
- result.M32 = left.M32 / right;
- result.M33 = left.M33 / right;
- result.M34 = left.M34 / right;
- result.M41 = left.M41 / right;
- result.M42 = left.M42 / right;
- result.M43 = left.M43 / right;
- result.M44 = left.M44 / right;
- return result;
- }
+ public static MatrixD operator /(MatrixD left, double right)
+ {
+ MatrixD result = default(MatrixD);
+ result.M11 = left.M11 / right;
+ result.M12 = left.M12 / right;
+ result.M13 = left.M13 / right;
+ result.M14 = left.M14 / right;
+ result.M21 = left.M21 / right;
+ result.M22 = left.M22 / right;
+ result.M23 = left.M23 / right;
+ result.M24 = left.M24 / right;
+ result.M31 = left.M31 / right;
+ result.M32 = left.M32 / right;
+ result.M33 = left.M33 / right;
+ result.M34 = left.M34 / right;
+ result.M41 = left.M41 / right;
+ result.M42 = left.M42 / right;
+ result.M43 = left.M43 / right;
+ result.M44 = left.M44 / right;
+ return result;
+ }
- public static bool operator ==(MatrixD left, MatrixD right)
- {
- if (left.M11 == right.M11 && left.M12 == right.M12 && left.M13 == right.M13 && left.M14 == right.M14 && left.M21 == right.M21 && left.M22 == right.M22 && left.M23 == right.M23 && left.M24 == right.M24 && left.M31 == right.M31 && left.M32 == right.M32 && left.M33 == right.M33 && left.M34 == right.M34 && left.M41 == right.M41 && left.M42 == right.M42 && left.M43 == right.M43)
- {
- return left.M44 == right.M44;
- }
- return false;
- }
+ public static bool operator ==(MatrixD left, MatrixD right)
+ {
+ if (left.M11 == right.M11 && left.M12 == right.M12 && left.M13 == right.M13 && left.M14 == right.M14 && left.M21 == right.M21 && left.M22 == right.M22 && left.M23 == right.M23 && left.M24 == right.M24 && left.M31 == right.M31 && left.M32 == right.M32 && left.M33 == right.M33 && left.M34 == right.M34 && left.M41 == right.M41 && left.M42 == right.M42 && left.M43 == right.M43)
+ {
+ return left.M44 == right.M44;
+ }
+ return false;
+ }
- public static bool operator !=(MatrixD left, MatrixD right)
- {
- if (left.M11 == right.M11 && left.M12 == right.M12 && left.M13 == right.M13 && left.M14 == right.M14 && left.M21 == right.M21 && left.M22 == right.M22 && left.M23 == right.M23 && left.M24 == right.M24 && left.M31 == right.M31 && left.M32 == right.M32 && left.M33 == right.M33 && left.M34 == right.M34 && left.M41 == right.M41 && left.M42 == right.M42 && left.M43 == right.M43)
- {
- return left.M44 != right.M44;
- }
- return true;
- }
+ public static bool operator !=(MatrixD left, MatrixD right)
+ {
+ if (left.M11 == right.M11 && left.M12 == right.M12 && left.M13 == right.M13 && left.M14 == right.M14 && left.M21 == right.M21 && left.M22 == right.M22 && left.M23 == right.M23 && left.M24 == right.M24 && left.M31 == right.M31 && left.M32 == right.M32 && left.M33 == right.M33 && left.M34 == right.M34 && left.M41 == right.M41 && left.M42 == right.M42 && left.M43 == right.M43)
+ {
+ return left.M44 != right.M44;
+ }
+ return true;
+ }
- public override string ToString()
- {
- return string.Format(CultureInfo.CurrentCulture, "[M11:{0} M12:{1} M13:{2} M14:{3}] [M21:{4} M22:{5} M23:{6} M24:{7}] [M31:{8} M32:{9} M33:{10} M34:{11}] [M41:{12} M42:{13} M43:{14} M44:{15}]", M11.ToString(CultureInfo.CurrentCulture), M12.ToString(CultureInfo.CurrentCulture), M13.ToString(CultureInfo.CurrentCulture), M14.ToString(CultureInfo.CurrentCulture), M21.ToString(CultureInfo.CurrentCulture), M22.ToString(CultureInfo.CurrentCulture), M23.ToString(CultureInfo.CurrentCulture), M24.ToString(CultureInfo.CurrentCulture), M31.ToString(CultureInfo.CurrentCulture), M32.ToString(CultureInfo.CurrentCulture), M33.ToString(CultureInfo.CurrentCulture), M34.ToString(CultureInfo.CurrentCulture), M41.ToString(CultureInfo.CurrentCulture), M42.ToString(CultureInfo.CurrentCulture), M43.ToString(CultureInfo.CurrentCulture), M44.ToString(CultureInfo.CurrentCulture));
- }
+ public override string ToString()
+ {
+ return string.Format(CultureInfo.CurrentCulture, "[M11:{0} M12:{1} M13:{2} M14:{3}] [M21:{4} M22:{5} M23:{6} M24:{7}] [M31:{8} M32:{9} M33:{10} M34:{11}] [M41:{12} M42:{13} M43:{14} M44:{15}]", M11.ToString(CultureInfo.CurrentCulture), M12.ToString(CultureInfo.CurrentCulture), M13.ToString(CultureInfo.CurrentCulture), M14.ToString(CultureInfo.CurrentCulture), M21.ToString(CultureInfo.CurrentCulture), M22.ToString(CultureInfo.CurrentCulture), M23.ToString(CultureInfo.CurrentCulture), M24.ToString(CultureInfo.CurrentCulture), M31.ToString(CultureInfo.CurrentCulture), M32.ToString(CultureInfo.CurrentCulture), M33.ToString(CultureInfo.CurrentCulture), M34.ToString(CultureInfo.CurrentCulture), M41.ToString(CultureInfo.CurrentCulture), M42.ToString(CultureInfo.CurrentCulture), M43.ToString(CultureInfo.CurrentCulture), M44.ToString(CultureInfo.CurrentCulture));
+ }
- public override int GetHashCode()
- {
- return M11.GetHashCode() + M12.GetHashCode() + M13.GetHashCode() + M14.GetHashCode() + M21.GetHashCode() + M22.GetHashCode() + M23.GetHashCode() + M24.GetHashCode() + M31.GetHashCode() + M32.GetHashCode() + M33.GetHashCode() + M34.GetHashCode() + M41.GetHashCode() + M42.GetHashCode() + M43.GetHashCode() + M44.GetHashCode();
- }
+ public override int GetHashCode()
+ {
+ return M11.GetHashCode() + M12.GetHashCode() + M13.GetHashCode() + M14.GetHashCode() + M21.GetHashCode() + M22.GetHashCode() + M23.GetHashCode() + M24.GetHashCode() + M31.GetHashCode() + M32.GetHashCode() + M33.GetHashCode() + M34.GetHashCode() + M41.GetHashCode() + M42.GetHashCode() + M43.GetHashCode() + M44.GetHashCode();
+ }
- public override bool Equals(object value)
- {
- if (value == null)
- {
- return false;
- }
- if (value.GetType() != GetType())
- {
- return false;
- }
- return Equals((MatrixD)value);
- }
+ public override bool Equals(object value)
+ {
+ if (value == null)
+ {
+ return false;
+ }
+ if (value.GetType() != GetType())
+ {
+ return false;
+ }
+ return Equals((MatrixD)value);
+ }
- public bool Equals(MatrixD value)
- {
- if (M11 == value.M11 && M12 == value.M12 && M13 == value.M13 && M14 == value.M14 && M21 == value.M21 && M22 == value.M22 && M23 == value.M23 && M24 == value.M24 && M31 == value.M31 && M32 == value.M32 && M33 == value.M33 && M34 == value.M34 && M41 == value.M41 && M42 == value.M42 && M43 == value.M43)
- {
- return M44 == value.M44;
- }
- return false;
- }
+ public bool Equals(MatrixD value)
+ {
+ if (M11 == value.M11 && M12 == value.M12 && M13 == value.M13 && M14 == value.M14 && M21 == value.M21 && M22 == value.M22 && M23 == value.M23 && M24 == value.M24 && M31 == value.M31 && M32 == value.M32 && M33 == value.M33 && M34 == value.M34 && M41 == value.M41 && M42 == value.M42 && M43 == value.M43)
+ {
+ return M44 == value.M44;
+ }
+ return false;
+ }
- public bool Equals(ref MatrixD value)
- {
- if (M11 == value.M11 && M12 == value.M12 && M13 == value.M13 && M14 == value.M14 && M21 == value.M21 && M22 == value.M22 && M23 == value.M23 && M24 == value.M24 && M31 == value.M31 && M32 == value.M32 && M33 == value.M33 && M34 == value.M34 && M41 == value.M41 && M42 == value.M42 && M43 == value.M43)
- {
- return M44 == value.M44;
- }
- return false;
- }
+ public bool Equals(ref MatrixD value)
+ {
+ if (M11 == value.M11 && M12 == value.M12 && M13 == value.M13 && M14 == value.M14 && M21 == value.M21 && M22 == value.M22 && M23 == value.M23 && M24 == value.M24 && M31 == value.M31 && M32 == value.M32 && M33 == value.M33 && M34 == value.M34 && M41 == value.M41 && M42 == value.M42 && M43 == value.M43)
+ {
+ return M44 == value.M44;
+ }
+ return false;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Med.cs b/2DGAMELIB/_2DGAMELIB/Med.cs
index ff72528..3b8480e 100644
--- a/2DGAMELIB/_2DGAMELIB/Med.cs
+++ b/2DGAMELIB/_2DGAMELIB/Med.cs
@@ -5,465 +5,466 @@ using System.Drawing;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
-namespace _2DGAMELIB;
-
-public class Med
+namespace _2DGAMELIB
{
- public static object obj;
+ public class Med
+ {
+ public static object obj;
- private GlImage baseControl;
+ private GlImage baseControl;
- public double Unit = 1762.4;
+ public double Unit = 1762.4;
- public Rect Base = new Rect(4.0, 3.0, 0.4);
+ public Rect Base = new Rect(4.0, 3.0, 0.4);
- public double DisQuality = 1.0;
+ public double DisQuality = 1.0;
- public double HitAccuracy = 0.5;
+ public double HitAccuracy = 0.5;
- public Bitmap BD;
+ public Bitmap BD;
- public Graphics GD;
+ public Graphics GD;
- public Bitmap BH;
+ public Bitmap BH;
- public Graphics GH;
+ public Graphics GH;
- private Color ClearColor = Color.Transparent;
+ private Color ClearColor = Color.Transparent;
- public bool Drive = true;
+ public bool Drive = true;
- private Size BaseSize = Size.Empty;
+ private Size BaseSize = Size.Empty;
- private double resMag = 1.0;
+ private double resMag = 1.0;
- private Vector2D resVector = Dat.Vec2DZero;
+ private Vector2D resVector = Dat.Vec2DZero;
- private Sce Sce;
+ private Sce Sce;
- private string mode;
+ private string mode;
- public string Modeb;
+ public string Modeb;
- private Dictionary Modes;
+ private Dictionary Modes;
- private Func> GetModes;
+ private Func> GetModes;
- private int WidthM;
+ private int WidthM;
- private int HeightM;
+ private int HeightM;
- public static double FPS;
+ public static double FPS;
- public FPS FPSF = new FPS(FPS);
+ public FPS FPSF = new FPS(FPS);
- private bool cur = true;
+ private bool cur = true;
- public HashSet HitColors = new HashSet
- {
- Color.Transparent,
- Color.Black
- };
+ public HashSet HitColors = new HashSet
+ {
+ Color.Transparent,
+ Color.Black
+ };
- private const int LOGPIXELSX = 88;
+ private const int LOGPIXELSX = 88;
- private const int LOGPIXELSY = 90;
+ private const int LOGPIXELSY = 90;
- public static double dpiX;
+ public static double dpiX;
- public static double dpiY;
+ public static double dpiY;
- public static double DpiX;
+ public static double DpiX;
- public static double DpiY;
+ public static double DpiY;
- public string UITitle;
+ public string UITitle;
- public bool ShowFPS;
+ public bool ShowFPS;
- //public Control BaseControlC => baseControl;
+ //public Control BaseControlC => baseControl;
- public GlImage BaseControl => baseControl;
+ public GlImage BaseControl => baseControl;
- public double ResMag => resMag;
+ public double ResMag => resMag;
- public Vector2D ResVector => resVector;
+ public Vector2D ResVector => resVector;
- public string Mode
- {
- get
- {
- return mode;
- }
- set
- {
- Modes[mode].Up(MouseButtons.None, Dat.Vec2DZero, Color.Empty);
- Modes[mode].Move(MouseButtons.None, Dat.Vec2DZero, Color.Empty);
- Modeb = mode;
- mode = value;
- Modes[mode].Move(MouseButtons.None, Dat.Vec2DZero, Color.Empty);
- Modes[mode].Setting();
- }
- }
+ public string Mode
+ {
+ get
+ {
+ return mode;
+ }
+ set
+ {
+ Modes[mode].Up(MouseButtons.None, Dat.Vec2DZero, Color.Empty);
+ Modes[mode].Move(MouseButtons.None, Dat.Vec2DZero, Color.Empty);
+ Modeb = mode;
+ mode = value;
+ Modes[mode].Move(MouseButtons.None, Dat.Vec2DZero, Color.Empty);
+ Modes[mode].Setting();
+ }
+ }
- public Vector2D CursorPosition => ToBasePosition(baseControl.GetCursorPoint()); //ToBasePosition(baseControl.PointToClient(System.Windows.Forms.Cursor.Position));
+ public Vector2D CursorPosition => ToBasePosition(baseControl.GetCursorPoint()); //ToBasePosition(baseControl.PointToClient(System.Windows.Forms.Cursor.Position));
- public Med()
- {
- Point dpi = GetDpi();
- dpiX = dpi.X;
- dpiY = dpi.Y;
- DpiX = 96.0 / dpiX;
- DpiY = 96.0 / dpiY;
- }
+ public Med()
+ {
+ Point dpi = GetDpi();
+ dpiX = dpi.X;
+ dpiY = dpi.Y;
+ DpiX = 96.0 / dpiX;
+ DpiY = 96.0 / dpiY;
+ }
- public void FadeIn(double Rate)
- {
- Sce.TransformAlpha(GD, Rate);
- }
+ public void FadeIn(double Rate)
+ {
+ Sce.TransformAlpha(GD, Rate);
+ }
- public void FadeOut(double Rate)
- {
- Sce.TransD(GD, Rate);
- }
+ public void FadeOut(double Rate)
+ {
+ Sce.TransD(GD, Rate);
+ }
- public void DrawStart(Are Are)
- {
- Sce.DrawStart(Are);
- }
+ public void DrawStart(Are Are)
+ {
+ Sce.DrawStart(Are);
+ }
- public void DrawEnd(Are Are)
- {
- Sce.DrawEnd(Are);
- }
+ public void DrawEnd(Are Are)
+ {
+ Sce.DrawEnd(Are);
+ }
- public void ClearSta(Color ClearColor)
- {
- Sce.ClearStart(ref ClearColor);
- }
+ public void ClearSta(Color ClearColor)
+ {
+ Sce.ClearStart(ref ClearColor);
+ }
- public void InitializeModes(string Mode, Func> GetModes)
- {
- mode = Mode;
- this.GetModes = GetModes;
- }
+ public void InitializeModes(string Mode, Func> GetModes)
+ {
+ mode = Mode;
+ this.GetModes = GetModes;
+ }
- public Size Setting(GlImage BaseControl)
- {
- baseControl = BaseControl;
- BaseSize = new Size((int)(Base.LocalWidth * Unit), (int)(Base.LocalHeight * Unit));
- BD = new Bitmap(BaseSize.Width, BaseSize.Height);
- GD = Graphics.FromImage(BD);
- GD.InterpolationMode = InterpolationMode.HighQualityBilinear;
- BH = new Bitmap((int)((double)BaseSize.Width * HitAccuracy), (int)((double)BaseSize.Height * HitAccuracy));
- GH = Graphics.FromImage(BH);
- GH.InterpolationMode = InterpolationMode.Bilinear;
- WidthM = BH.Width - 1;
- HeightM = BH.Height - 1;
- Clear();
- Sce = new Sce(BaseSize.Width, BaseSize.Height);
- Modes = GetModes(this);
+ public Size Setting(GlImage BaseControl)
+ {
+ baseControl = BaseControl;
+ BaseSize = new Size((int)(Base.LocalWidth * Unit), (int)(Base.LocalHeight * Unit));
+ BD = new Bitmap(BaseSize.Width, BaseSize.Height);
+ GD = Graphics.FromImage(BD);
+ GD.InterpolationMode = InterpolationMode.HighQualityBilinear;
+ BH = new Bitmap((int)((double)BaseSize.Width * HitAccuracy), (int)((double)BaseSize.Height * HitAccuracy));
+ GH = Graphics.FromImage(BH);
+ GH.InterpolationMode = InterpolationMode.Bilinear;
+ WidthM = BH.Width - 1;
+ HeightM = BH.Height - 1;
+ Clear();
+ Sce = new Sce(BaseSize.Width, BaseSize.Height);
+ Modes = GetModes(this);
- BaseControl.Click = delegate (IntPtr window, GLFW.MouseButton button, InputState state, GLFW.ModifierKeys modifiers)
- {
- double x, y;
- Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
- Point Position5 = new Point((int)x, (int)y);
- MouseButtons arg2 = MouseButtons.None;
- switch (button)
+ BaseControl.Click = delegate (IntPtr window, GLFW.MouseButton button, InputState state, GLFW.ModifierKeys modifiers)
{
- case GLFW.MouseButton.Left:
- arg2 = MouseButtons.Left;
- break;
- case GLFW.MouseButton.Middle:
- arg2 = MouseButtons.Middle;
- break;
- case GLFW.MouseButton.Right:
- arg2 = MouseButtons.Right;
- break;
- case GLFW.MouseButton.Button4:
- arg2 = MouseButtons.Button4;
- break;
- case GLFW.MouseButton.Button5:
- arg2 = MouseButtons.Button5;
- break;
- }
-
-
- (state == InputState.Press ? Modes[mode].Down : Modes[mode].Up)(arg2, ToBasePosition(Position5), GetHitColor(ref Position5));
- };
-
- BaseControl.Move = delegate (IntPtr window, double x, double y)
- {
- Point Position3 = new Point((int)x, (int)y);
- Modes[mode].Move(BaseControl.GetMouseButtons(), ToBasePosition(Position3), GetHitColor(ref Position3));
- };
-
- BaseControl.Leave = delegate (IntPtr window, bool entered)
- {
- if (!entered)
- {
- double x, y;
- Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
- Point Position2 = new Point((int)x, (int)y);
- Modes[mode].Leave(BaseControl.GetMouseButtons(), ToBasePosition(Position2), GetHitColor(ref Position2));
- }
- };
-
- BaseControl.Scroll = delegate (IntPtr window, double xo, double yo)
- {
- double x, y;
- Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
- Point Position = new Point((int)x, (int)y);
- //Note: yo may be inverted
- Modes[mode].Wheel(BaseControl.GetMouseButtons(), ToBasePosition(Position), (int)yo, GetHitColor(ref Position));
- };
-
- BaseControl.Resize = delegate (IntPtr window, int width, int height)
- {
- //TODO mess with viewport
- if (BaseSize.Width >= BaseSize.Height)
- {
- double num = (double)BaseSize.Width / (double)BaseSize.Height;
- if ((double)width / (double)height <= num)
+ double x, y;
+ Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
+ Point Position5 = new Point((int)x, (int)y);
+ MouseButtons arg2 = MouseButtons.None;
+ switch (button)
{
- resMag = (double)BaseSize.Width / (double)width;
- resVector.X = 0.0;
- resVector.Y = ((double)height - (double)BaseSize.Height / resMag) * 0.5;
+ case GLFW.MouseButton.Left:
+ arg2 = MouseButtons.Left;
+ break;
+ case GLFW.MouseButton.Middle:
+ arg2 = MouseButtons.Middle;
+ break;
+ case GLFW.MouseButton.Right:
+ arg2 = MouseButtons.Right;
+ break;
+ case GLFW.MouseButton.Button4:
+ arg2 = MouseButtons.Button4;
+ break;
+ case GLFW.MouseButton.Button5:
+ arg2 = MouseButtons.Button5;
+ break;
+ }
+
+
+ (state == InputState.Press ? Modes[mode].Down : Modes[mode].Up)(arg2, ToBasePosition(Position5), GetHitColor(ref Position5));
+ };
+
+ BaseControl.Move = delegate (IntPtr window, double x, double y)
+ {
+ Point Position3 = new Point((int)x, (int)y);
+ Modes[mode].Move(BaseControl.GetMouseButtons(), ToBasePosition(Position3), GetHitColor(ref Position3));
+ };
+
+ BaseControl.Leave = delegate (IntPtr window, bool entered)
+ {
+ if (!entered)
+ {
+ double x, y;
+ Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
+ Point Position2 = new Point((int)x, (int)y);
+ Modes[mode].Leave(BaseControl.GetMouseButtons(), ToBasePosition(Position2), GetHitColor(ref Position2));
+ }
+ };
+
+ BaseControl.Scroll = delegate (IntPtr window, double xo, double yo)
+ {
+ double x, y;
+ Glfw.GetCursorPosition(GlImage.PtrToWindow(window), out x, out y);
+ Point Position = new Point((int)x, (int)y);
+ //Note: yo may be inverted
+ Modes[mode].Wheel(BaseControl.GetMouseButtons(), ToBasePosition(Position), (int)yo, GetHitColor(ref Position));
+ };
+
+ BaseControl.Resize = delegate (IntPtr window, int width, int height)
+ {
+ //TODO mess with viewport
+ if (BaseSize.Width >= BaseSize.Height)
+ {
+ double num = (double)BaseSize.Width / (double)BaseSize.Height;
+ if ((double)width / (double)height <= num)
+ {
+ resMag = (double)BaseSize.Width / (double)width;
+ resVector.X = 0.0;
+ resVector.Y = ((double)height - (double)BaseSize.Height / resMag) * 0.5;
+ }
+ else
+ {
+ resMag = (double)BaseSize.Height / (double)height;
+ resVector.X = ((double)width - (double)BaseSize.Width / resMag) * 0.5;
+ resVector.Y = 0.0;
+ }
}
else
{
- resMag = (double)BaseSize.Height / (double)height;
- resVector.X = ((double)width - (double)BaseSize.Width / resMag) * 0.5;
- resVector.Y = 0.0;
+ double num2 = (double)BaseSize.Height / (double)BaseSize.Width;
+ if ((double)height / (double)width <= num2)
+ {
+ resMag = (double)BaseSize.Height / (double)height;
+ resVector.X = ((double)width - (double)BaseSize.Width / resMag) * 0.5;
+ resVector.Y = 0.0;
+ }
+ else
+ {
+ resMag = (double)BaseSize.Width / (double)width;
+ resVector.X = 0.0;
+ resVector.Y = ((double)height - (double)BaseSize.Height / resMag) * 0.5;
+ }
}
- }
- else
+ };
+
+ return BaseSize;
+ }
+
+ public Vector2D ToBasePosition(Point Position)
+ {
+ return new Vector2D(((double)Position.X - resVector.X) / Unit * resMag, ((double)Position.Y - resVector.Y) / Unit * resMag);
+ }
+
+ public Point FromBasePosition(Vector2D Position)
+ {
+ return new Point((int)(Position.X / resMag * Unit + resVector.X), (int)(Position.Y / resMag * Unit + resVector.Y));
+ }
+
+ public Color GetHitColor(Point Position)
+ {
+ double num = HitAccuracy * resMag;
+ Point point = ((Position.ToVector2D() - resVector) * num).ToPoint();
+ if (point.X < 0)
+ {
+ point.X = 0;
+ }
+ if (point.Y < 0)
+ {
+ point.Y = 0;
+ }
+ if (point.X > WidthM)
+ {
+ point.X = WidthM;
+ }
+ if (point.Y > HeightM)
+ {
+ point.Y = HeightM;
+ }
+ return BH.GetPixel(point.X, point.Y);
+ }
+
+ public Color GetHitColor(ref Point Position)
+ {
+ double num = HitAccuracy * resMag;
+ Point point = ((Position.ToVector2D() - resVector) * num).ToPoint();
+ if (point.X < 0)
+ {
+ point.X = 0;
+ }
+ if (point.Y < 0)
+ {
+ point.Y = 0;
+ }
+ if (point.X > WidthM)
+ {
+ point.X = WidthM;
+ }
+ if (point.Y > HeightM)
+ {
+ point.Y = HeightM;
+ }
+ return BH.GetPixel(point.X, point.Y);
+ }
+
+ public void Drawing()
+ {
+ baseControl.BitmapSetting(BD);
+ Modes[mode].Setting();
+ double FPS = 0.0;
+
+
+ Action action = delegate
+ {
+ FPS = FPSF.Value;
+ if (FPS > 1.0)
+ {
+ Modes[mode].Draw(FPSF);
+ }
+ baseControl.SetBitmap(BD);
+ };
+
+
+ while (Drive)
+ {
+ FPSF.FPSFixed(action);
+
+ if (ShowFPS)
+ {
+ baseControl.SetTitle(UITitle + " - FPS: " + System.Math.Round(FPSF.Value, 2));
+ }
+ baseControl.PollEvents();
+ }
+ }
+
+ public void Clear()
+ {
+ GD.Clear(ClearColor);
+ GH.Clear(ClearColor);
+ }
+
+ public void Draw(Are Are)
+ {
+ Are.Draw(GD, GH);
+ }
+
+ public void CursorHide()
+ {
+ if (cur)
+ {
+ //TODO fix?
+ //System.Windows.Forms.Cursor.Hide();
+ cur = false;
+ }
+ }
+
+ public void CursorShow()
+ {
+ if (!cur)
{
- double num2 = (double)BaseSize.Height / (double)BaseSize.Width;
- if ((double)height / (double)width <= num2)
- {
- resMag = (double)BaseSize.Height / (double)height;
- resVector.X = ((double)width - (double)BaseSize.Width / resMag) * 0.5;
- resVector.Y = 0.0;
- }
- else
- {
- resMag = (double)BaseSize.Width / (double)width;
- resVector.X = 0.0;
- resVector.Y = ((double)height - (double)BaseSize.Height / resMag) * 0.5;
- }
- }
- };
+ //TODO fix?
+ //System.Windows.Forms.Cursor.Show();
+ cur = true;
+ }
+ }
- return BaseSize;
- }
+ public void InvokeL(Action a)
+ {
+ //TODO this look right?
+ a();
+ //baseControl.Invoke(a);
+ }
- public Vector2D ToBasePosition(Point Position)
- {
- return new Vector2D(((double)Position.X - resVector.X) / Unit * resMag, ((double)Position.Y - resVector.Y) / Unit * resMag);
- }
+ public Color GetUniqueColor()
+ {
+ Oth.GetRandomColor(out var ret);
+ while (HitColors.Contains(ret))
+ {
+ Oth.GetRandomColor(out ret);
+ }
+ HitColors.Add(ret);
+ return ret;
+ }
- public Point FromBasePosition(Vector2D Position)
- {
- return new Point((int)(Position.X / resMag * Unit + resVector.X), (int)(Position.Y / resMag * Unit + resVector.Y));
- }
+ public void GetUniqueColor(out Color c)
+ {
+ Oth.GetRandomColor(out c);
+ while (HitColors.Contains(c))
+ {
+ Oth.GetRandomColor(out c);
+ }
+ HitColors.Add(c);
+ }
- public Color GetHitColor(Point Position)
- {
- double num = HitAccuracy * resMag;
- Point point = ((Position.ToVector2D() - resVector) * num).ToPoint();
- if (point.X < 0)
- {
- point.X = 0;
- }
- if (point.Y < 0)
- {
- point.Y = 0;
- }
- if (point.X > WidthM)
- {
- point.X = WidthM;
- }
- if (point.Y > HeightM)
- {
- point.Y = HeightM;
- }
- return BH.GetPixel(point.X, point.Y);
- }
+ public void SetUniqueColor(IEnumerable ps)
+ {
+ foreach (Par p in ps)
+ {
+ p.HitColor = GetUniqueColor();
+ }
+ }
- public Color GetHitColor(ref Point Position)
- {
- double num = HitAccuracy * resMag;
- Point point = ((Position.ToVector2D() - resVector) * num).ToPoint();
- if (point.X < 0)
- {
- point.X = 0;
- }
- if (point.Y < 0)
- {
- point.Y = 0;
- }
- if (point.X > WidthM)
- {
- point.X = WidthM;
- }
- if (point.Y > HeightM)
- {
- point.Y = HeightM;
- }
- return BH.GetPixel(point.X, point.Y);
- }
+ public void RemUniqueColor(Color Color)
+ {
+ HitColors.Remove(Color);
+ }
- public void Drawing()
- {
- baseControl.BitmapSetting(BD);
- Modes[mode].Setting();
- double FPS = 0.0;
+ public void RemUniqueColor(IEnumerable ps)
+ {
+ foreach (Par p in ps)
+ {
+ HitColors.Remove(p.HitColor);
+ }
+ }
+ public void Dispose()
+ {
+ Drive = false;
+ foreach (Module value in Modes.Values)
+ {
+ value.Dispose();
+ }
+ BD.Dispose();
+ GD.Dispose();
+ BH.Dispose();
+ GH.Dispose();
+ Sce.Dispose();
+ }
- Action action = delegate
- {
- FPS = FPSF.Value;
- if (FPS > 1.0)
- {
- Modes[mode].Draw(FPSF);
- }
- baseControl.SetBitmap(BD);
- };
+ [DllImport("user32.dll")]
+ private static extern bool SetProcessDPIAware();
+ [DllImport("user32.dll")]
+ private static extern IntPtr GetWindowDC(IntPtr hwnd);
- while (Drive)
- {
- FPSF.FPSFixed(action);
+ [DllImport("gdi32.dll")]
+ private static extern int GetDeviceCaps(IntPtr hdc, int index);
- if (ShowFPS)
- {
- baseControl.SetTitle(UITitle + " - FPS: " + System.Math.Round(FPSF.Value, 2));
- }
- baseControl.PollEvents();
- }
- }
+ [DllImport("user32.dll")]
+ private static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
- public void Clear()
- {
- GD.Clear(ClearColor);
- GH.Clear(ClearColor);
- }
+ public static Point GetDpi()
+ {
+ SetProcessDPIAware();
+ IntPtr windowDC = GetWindowDC(IntPtr.Zero);
+ Point result = new Point(GetDeviceCaps(windowDC, 88), GetDeviceCaps(windowDC, 90));
+ ReleaseDC(IntPtr.Zero, windowDC);
+ return result;
+ }
- public void Draw(Are Are)
- {
- Are.Draw(GD, GH);
- }
-
- public void CursorHide()
- {
- if (cur)
- {
- //TODO fix?
- //System.Windows.Forms.Cursor.Hide();
- cur = false;
- }
- }
-
- public void CursorShow()
- {
- if (!cur)
- {
- //TODO fix?
- //System.Windows.Forms.Cursor.Show();
- cur = true;
- }
- }
-
- public void InvokeL(Action a)
- {
- //TODO this look right?
- a();
- //baseControl.Invoke(a);
- }
-
- public Color GetUniqueColor()
- {
- Oth.GetRandomColor(out var ret);
- while (HitColors.Contains(ret))
- {
- Oth.GetRandomColor(out ret);
- }
- HitColors.Add(ret);
- return ret;
- }
-
- public void GetUniqueColor(out Color c)
- {
- Oth.GetRandomColor(out c);
- while (HitColors.Contains(c))
- {
- Oth.GetRandomColor(out c);
- }
- HitColors.Add(c);
- }
-
- public void SetUniqueColor(IEnumerable ps)
- {
- foreach (Par p in ps)
- {
- p.HitColor = GetUniqueColor();
- }
- }
-
- public void RemUniqueColor(Color Color)
- {
- HitColors.Remove(Color);
- }
-
- public void RemUniqueColor(IEnumerable ps)
- {
- foreach (Par p in ps)
- {
- HitColors.Remove(p.HitColor);
- }
- }
-
- public void Dispose()
- {
- Drive = false;
- foreach (Module value in Modes.Values)
- {
- value.Dispose();
- }
- BD.Dispose();
- GD.Dispose();
- BH.Dispose();
- GH.Dispose();
- Sce.Dispose();
- }
-
- [DllImport("user32.dll")]
- private static extern bool SetProcessDPIAware();
-
- [DllImport("user32.dll")]
- private static extern IntPtr GetWindowDC(IntPtr hwnd);
-
- [DllImport("gdi32.dll")]
- private static extern int GetDeviceCaps(IntPtr hdc, int index);
-
- [DllImport("user32.dll")]
- private static extern int ReleaseDC(IntPtr hwnd, IntPtr hdc);
-
- public static Point GetDpi()
- {
- SetProcessDPIAware();
- IntPtr windowDC = GetWindowDC(IntPtr.Zero);
- Point result = new Point(GetDeviceCaps(windowDC, 88), GetDeviceCaps(windowDC, 90));
- ReleaseDC(IntPtr.Zero, windowDC);
- return result;
- }
-
- static Med()
- {
- obj = new object();
- FPS = 60.0;
- }
+ static Med()
+ {
+ obj = new object();
+ FPS = 60.0;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Module.cs b/2DGAMELIB/_2DGAMELIB/Module.cs
index 71f4bd5..416128f 100644
--- a/2DGAMELIB/_2DGAMELIB/Module.cs
+++ b/2DGAMELIB/_2DGAMELIB/Module.cs
@@ -1,39 +1,40 @@
using System;
using System.Drawing;
-namespace _2DGAMELIB;
-
-public class Module
+namespace _2DGAMELIB
{
- public Action Down = delegate
- {
- };
+ public class Module
+ {
+ public Action Down = delegate
+ {
+ };
- public Action Up = delegate
- {
- };
+ public Action Up = delegate
+ {
+ };
- public Action Move = delegate
- {
- };
+ public Action Move = delegate
+ {
+ };
- public Action Leave = delegate
- {
- };
+ public Action Leave = delegate
+ {
+ };
- public Action Wheel = delegate
- {
- };
+ public Action Wheel = delegate
+ {
+ };
- public Action Draw = delegate
- {
- };
+ public Action Draw = delegate
+ {
+ };
- public Action Dispose = delegate
- {
- };
+ public Action Dispose = delegate
+ {
+ };
- public Action Setting = delegate
- {
- };
+ public Action Setting = delegate
+ {
+ };
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Mot.cs b/2DGAMELIB/_2DGAMELIB/Mot.cs
index f9f3148..e0ceaae 100644
--- a/2DGAMELIB/_2DGAMELIB/Mot.cs
+++ b/2DGAMELIB/_2DGAMELIB/Mot.cs
@@ -1,76 +1,77 @@
using System;
-namespace _2DGAMELIB;
-
-public class Mot : MotV
+namespace _2DGAMELIB
{
- public Action Staing;
+ public class Mot : MotV
+ {
+ public Action Staing;
- public Action Runing;
+ public Action Runing;
- public Action Reaing;
+ public Action Reaing;
- public Action Rouing;
+ public Action Rouing;
- public Action Ending;
+ public Action Ending;
- private bool run;
+ private bool run;
- private bool rou;
+ private bool rou;
- public bool Run => run;
+ public bool Run => run;
- public Mot(double Min, double Max)
- : base(Min, Max)
- {
- }
+ public Mot(double Min, double Max)
+ : base(Min, Max)
+ {
+ }
- public new void GetValue(FPS FPS)
- {
- if (!run)
- {
- return;
- }
- base.GetValue(FPS);
- if (Runing != null)
- {
- Runing(this);
- }
- if (Value == min)
- {
- if (rou && Rouing != null)
- {
- Rouing(this);
- }
- rou = false;
- }
- else if (Value == max)
- {
- if (Reaing != null)
- {
- Reaing(this);
- }
- rou = true;
- }
- }
+ public new void GetValue(FPS FPS)
+ {
+ if (!run)
+ {
+ return;
+ }
+ base.GetValue(FPS);
+ if (Runing != null)
+ {
+ Runing(this);
+ }
+ if (Value == min)
+ {
+ if (rou && Rouing != null)
+ {
+ Rouing(this);
+ }
+ rou = false;
+ }
+ else if (Value == max)
+ {
+ if (Reaing != null)
+ {
+ Reaing(this);
+ }
+ rou = true;
+ }
+ }
- public void Start()
- {
- if (Staing != null)
- {
- Staing(this);
- }
- run = true;
- }
+ public void Start()
+ {
+ if (Staing != null)
+ {
+ Staing(this);
+ }
+ run = true;
+ }
- public void End()
- {
- run = false;
- if (Ending != null)
- {
- Ending(this);
- }
- ResetValue();
- rou = false;
- }
+ public void End()
+ {
+ run = false;
+ if (Ending != null)
+ {
+ Ending(this);
+ }
+ ResetValue();
+ rou = false;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/MotV.cs b/2DGAMELIB/_2DGAMELIB/MotV.cs
index aed4815..168926f 100644
--- a/2DGAMELIB/_2DGAMELIB/MotV.cs
+++ b/2DGAMELIB/_2DGAMELIB/MotV.cs
@@ -1,108 +1,109 @@
-namespace _2DGAMELIB;
-
-public class MotV
+namespace _2DGAMELIB
{
- public double Value;
+ public class MotV
+ {
+ public double Value;
- protected double min = -1.0;
+ protected double min = -1.0;
- protected double max = 1.0;
+ protected double max = 1.0;
- private double Frame;
+ private double Frame;
- private double FrameHalf;
+ private double FrameHalf;
- private double MinFrameHalf;
+ private double MinFrameHalf;
- public double BaseSpeed = 1.0;
+ public double BaseSpeed = 1.0;
- public double GotoSpeed = 1.0;
+ public double GotoSpeed = 1.0;
- public double RetuSpeed = 1.0;
+ public double RetuSpeed = 1.0;
- public double Interval;
+ public double Interval;
- private long st;
+ private long st;
- public double LowestIncrease = 1.0;
+ public double LowestIncrease = 1.0;
- private int s = 1;
+ private int s = 1;
- private double d;
+ private double d;
- private double m;
+ private double m;
- public double Min
- {
- get
- {
- return min;
- }
- set
- {
- min = value;
- SetFrame();
- }
- }
+ public double Min
+ {
+ get
+ {
+ return min;
+ }
+ set
+ {
+ min = value;
+ SetFrame();
+ }
+ }
- public double Max
- {
- get
- {
- return max;
- }
- set
- {
- max = value;
- SetFrame();
- }
- }
+ public double Max
+ {
+ get
+ {
+ return max;
+ }
+ set
+ {
+ max = value;
+ SetFrame();
+ }
+ }
- public MotV(double Min, double Max)
- {
- min = Min;
- max = Max;
- SetFrame();
- ResetValue();
- }
+ public MotV(double Min, double Max)
+ {
+ min = Min;
+ max = Max;
+ SetFrame();
+ ResetValue();
+ }
- private void SetFrame()
- {
- Frame = max - min;
- FrameHalf = Frame * 0.5;
- MinFrameHalf = Min + FrameHalf;
- }
+ private void SetFrame()
+ {
+ Frame = max - min;
+ FrameHalf = Frame * 0.5;
+ MinFrameHalf = Min + FrameHalf;
+ }
- public void ResetValue()
- {
- Value = min;
- }
+ public void ResetValue()
+ {
+ Value = min;
+ }
- private void Count(FPS FPS)
- {
- m = Frame / FPS.Value;
- Value += (m * d + m * LowestIncrease) * BaseSpeed * ((s > 0) ? GotoSpeed : RetuSpeed) * (double)s;
- }
+ private void Count(FPS FPS)
+ {
+ m = Frame / FPS.Value;
+ Value += (m * d + m * LowestIncrease) * BaseSpeed * ((s > 0) ? GotoSpeed : RetuSpeed) * (double)s;
+ }
- public void GetValue(FPS FPS)
- {
- if (!((double)(FPS.sw.ElapsedMilliseconds - st) < Interval) && FPS.Value > 0.0)
- {
- d = (MinFrameHalf - Value) / FrameHalf;
- d *= d.Sign();
- d = d.Inverse();
- Count(FPS);
- if (Value >= max)
- {
- Value = max;
- s = -s;
- }
- else if (Value <= min)
- {
- Value = min;
- s = -s;
- st = FPS.sw.ElapsedMilliseconds;
- }
- }
- }
+ public void GetValue(FPS FPS)
+ {
+ if (!((double)(FPS.sw.ElapsedMilliseconds - st) < Interval) && FPS.Value > 0.0)
+ {
+ d = (MinFrameHalf - Value) / FrameHalf;
+ d *= d.Sign();
+ d = d.Inverse();
+ Count(FPS);
+ if (Value >= max)
+ {
+ Value = max;
+ s = -s;
+ }
+ else if (Value <= min)
+ {
+ Value = min;
+ s = -s;
+ st = FPS.sw.ElapsedMilliseconds;
+ }
+ }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Mots.cs b/2DGAMELIB/_2DGAMELIB/Mots.cs
index 847dfcc..3751a3e 100644
--- a/2DGAMELIB/_2DGAMELIB/Mots.cs
+++ b/2DGAMELIB/_2DGAMELIB/Mots.cs
@@ -1,43 +1,44 @@
using System.Collections.Generic;
-namespace _2DGAMELIB;
-
-public class Mots
+namespace _2DGAMELIB
{
- public Dictionary ms;
+ public class Mots
+ {
+ public Dictionary ms;
- public Mot this[string Name]
- {
- get
- {
- return ms[Name];
- }
- set
- {
- ms[Name] = value;
- }
- }
+ public Mot this[string Name]
+ {
+ get
+ {
+ return ms[Name];
+ }
+ set
+ {
+ ms[Name] = value;
+ }
+ }
- public Mots()
- {
- ms = new Dictionary();
- }
+ public Mots()
+ {
+ ms = new Dictionary();
+ }
- public void Add(string Name, Mot Mot)
- {
- ms.Add(Name, Mot);
- }
+ public void Add(string Name, Mot Mot)
+ {
+ ms.Add(Name, Mot);
+ }
- public void Rem(string Name)
- {
- ms.Remove(Name);
- }
+ public void Rem(string Name)
+ {
+ ms.Remove(Name);
+ }
- public void Drive(FPS FPS)
- {
- foreach (Mot value in ms.Values)
- {
- value.GetValue(FPS);
- }
- }
+ public void Drive(FPS FPS)
+ {
+ foreach (Mot value in ms.Values)
+ {
+ value.GetValue(FPS);
+ }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/MyRandom.cs b/2DGAMELIB/_2DGAMELIB/MyRandom.cs
index 56e452d..5730e1d 100644
--- a/2DGAMELIB/_2DGAMELIB/MyRandom.cs
+++ b/2DGAMELIB/_2DGAMELIB/MyRandom.cs
@@ -1,221 +1,222 @@
using System;
-namespace _2DGAMELIB;
-
-public class MyRandom : Random
+namespace _2DGAMELIB
{
- protected uint x;
+ public class MyRandom : Random
+ {
+ protected uint x;
- protected uint y;
+ protected uint y;
- protected uint z;
+ protected uint z;
- protected uint w;
+ protected uint w;
- private const double d_4294967296 = 2.3283064365386963E-10;
+ private const double d_4294967296 = 2.3283064365386963E-10;
- private const double d_9007199254740992 = 1.1102230246251565E-16;
+ private const double d_9007199254740992 = 1.1102230246251565E-16;
- protected uint InitMtSub(uint s, uint i)
- {
- return 1812433253 * (s ^ (s >> 30)) + i + 1;
- }
+ protected uint InitMtSub(uint s, uint i)
+ {
+ return 1812433253 * (s ^ (s >> 30)) + i + 1;
+ }
- public void Initialize(uint s)
- {
- x = InitMtSub(s, 0u);
- y = InitMtSub(x, 1u);
- z = InitMtSub(y, 2u);
- w = InitMtSub(z, 3u);
- }
+ public void Initialize(uint s)
+ {
+ x = InitMtSub(s, 0u);
+ y = InitMtSub(x, 1u);
+ z = InitMtSub(y, 2u);
+ w = InitMtSub(z, 3u);
+ }
- public MyRandom(uint s)
- {
- Initialize(s);
- }
+ public MyRandom(uint s)
+ {
+ Initialize(s);
+ }
- public MyRandom()
- : this(4357u)
- {
- }
+ public MyRandom()
+ : this(4357u)
+ {
+ }
- public void Initialize(uint[] key)
- {
- uint num = (uint)key.Length;
- uint[] array = new uint[4];
- Initialize(1u);
- array[0] = x;
- array[1] = y;
- array[2] = z;
- array[3] = w;
- uint s = w;
- uint num2;
- for (num2 = 0u; num2 < num; num2++)
- {
- array[num2 & 3] ^= (s = InitMtSub(s, key[num2] + num2));
- }
- uint num3 = 0u;
- while (num3 < 3)
- {
- array[num2 & 3] ^= (s = InitMtSub(s, num3));
- num3++;
- num2++;
- }
- x = array[0];
- y = array[1];
- z = array[2];
- w = array[3];
- if (x == 0 && y == 0 && z == 0 && w == 0)
- {
- x = 1u;
- }
- }
+ public void Initialize(uint[] key)
+ {
+ uint num = (uint)key.Length;
+ uint[] array = new uint[4];
+ Initialize(1u);
+ array[0] = x;
+ array[1] = y;
+ array[2] = z;
+ array[3] = w;
+ uint s = w;
+ uint num2;
+ for (num2 = 0u; num2 < num; num2++)
+ {
+ array[num2 & 3] ^= (s = InitMtSub(s, key[num2] + num2));
+ }
+ uint num3 = 0u;
+ while (num3 < 3)
+ {
+ array[num2 & 3] ^= (s = InitMtSub(s, num3));
+ num3++;
+ num2++;
+ }
+ x = array[0];
+ y = array[1];
+ z = array[2];
+ w = array[3];
+ if (x == 0 && y == 0 && z == 0 && w == 0)
+ {
+ x = 1u;
+ }
+ }
- public MyRandom(uint[] key)
- {
- Initialize(key);
- }
+ public MyRandom(uint[] key)
+ {
+ Initialize(key);
+ }
- public override int Next()
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- return (int)(0.5 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
- }
+ public override int Next()
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ return (int)(0.5 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
+ }
- public override int Next(int les)
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- return (int)((double)les * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
- }
+ public override int Next(int les)
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ return (int)((double)les * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
+ }
- public void Next(int les, out int o)
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- o = (int)((double)les * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
- }
+ public void Next(int les, out int o)
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ o = (int)((double)les * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
+ }
- public override int Next(int sta, int les)
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- return (int)((double)(les - sta) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))) + sta;
- }
+ public override int Next(int sta, int les)
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ return (int)((double)(les - sta) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))) + sta;
+ }
- public int NextM(int max)
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- return (int)((double)((long)max + 1L) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
- }
+ public int NextM(int max)
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ return (int)((double)((long)max + 1L) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)));
+ }
- public int NextM(int min, int max)
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- return (int)((double)((long)(max - min) + 1L) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))) + min;
- }
+ public int NextM(int min, int max)
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ return (int)((double)((long)(max - min) + 1L) * 2.3283064365386963E-10 * (double)(w = w ^ (w >> 19) ^ num ^ (num >> 8))) + min;
+ }
- public override double NextDouble()
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
- num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- return 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
- }
+ public override double NextDouble()
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
+ num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ return 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
+ }
- public double NextDouble(double les)
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
- num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- return les * 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
- }
+ public double NextDouble(double les)
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
+ num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ return les * 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
+ }
- public double NextDouble(double sta, double les)
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
- num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- return (les - sta) * 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2) + sta;
- }
+ public double NextDouble(double sta, double les)
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
+ num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ return (les - sta) * 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2) + sta;
+ }
- public bool NextBool()
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- return (w = w ^ (w >> 19) ^ num ^ (num >> 8)) % 2 == 0;
- }
+ public bool NextBool()
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ return (w = w ^ (w >> 19) ^ num ^ (num >> 8)) % 2 == 0;
+ }
- public int NextSign()
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- if ((w = w ^ (w >> 19) ^ num ^ (num >> 8)) % 2 != 0)
- {
- return -1;
- }
- return 1;
- }
+ public int NextSign()
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ if ((w = w ^ (w >> 19) ^ num ^ (num >> 8)) % 2 != 0)
+ {
+ return -1;
+ }
+ return 1;
+ }
- public double NextNorCos(double mu = 0.0, double sigma = 1.0)
- {
- uint num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
- num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- double d = 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
- num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
- num = x ^ (x << 11);
- x = y;
- y = z;
- z = w;
- double num3 = 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
- return System.Math.Sqrt(-2.0 * System.Math.Log(d)) * System.Math.Cos(System.Math.PI * 2.0 * num3) * sigma + mu;
- }
+ public double NextNorCos(double mu = 0.0, double sigma = 1.0)
+ {
+ uint num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ uint num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
+ num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ double d = 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
+ num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ num2 = (w = w ^ (w >> 19) ^ num ^ (num >> 8)) >> 11;
+ num = x ^ (x << 11);
+ x = y;
+ y = z;
+ z = w;
+ double num3 = 1.1102230246251565E-16 * ((double)(w = w ^ (w >> 19) ^ num ^ (num >> 8)) * 2097152.0 + (double)num2);
+ return System.Math.Sqrt(-2.0 * System.Math.Log(d)) * System.Math.Cos(System.Math.PI * 2.0 * num3) * sigma + mu;
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/Obj.cs b/2DGAMELIB/_2DGAMELIB/Obj.cs
index c039703..758b92e 100644
--- a/2DGAMELIB/_2DGAMELIB/Obj.cs
+++ b/2DGAMELIB/_2DGAMELIB/Obj.cs
@@ -4,609 +4,610 @@ using System.Drawing;
using System.Linq;
using System.IO;
-namespace _2DGAMELIB;
-
-[Serializable]
-public class Obj
+namespace _2DGAMELIB
{
- public string Tag = "";
+ [Serializable]
+ public class Obj
+ {
+ public string Tag = "";
- public OrderedDictionary Difss = new OrderedDictionary();
+ public OrderedDictionary Difss = new OrderedDictionary();
- private Difs r;
+ private Difs r;
- private JointsD jsd;
+ private JointsD jsd;
- public IEnumerable Keys => Difss.Keys;
+ public IEnumerable Keys => Difss.Keys;
- public IEnumerable Values => Difss.Values;
+ public IEnumerable Values => Difss.Values;
- public Difs this[string Name]
- {
- get
- {
- return Difss[Name];
- }
- set
- {
- Difss[Name] = value;
- }
- }
+ public Difs this[string Name]
+ {
+ get
+ {
+ return Difss[Name];
+ }
+ set
+ {
+ Difss[Name] = value;
+ }
+ }
- public Difs this[int Index]
- {
- get
- {
- return Difss[Index];
- }
- set
- {
- Difss[Index] = value;
- }
- }
+ public Difs this[int Index]
+ {
+ get
+ {
+ return Difss[Index];
+ }
+ set
+ {
+ Difss[Index] = value;
+ }
+ }
- public double PositionSize
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.PositionSize = value;
- }
- }
- }
+ public double PositionSize
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.PositionSize = value;
+ }
+ }
+ }
- public Vector2D PositionVector
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.PositionVector = value;
- }
- }
- }
+ public Vector2D PositionVector
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.PositionVector = value;
+ }
+ }
+ }
- public double AngleBase
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.AngleBase = value;
- }
- }
- }
+ public double AngleBase
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.AngleBase = value;
+ }
+ }
+ }
- public double AngleCont
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.AngleCont = value;
- }
- }
- }
+ public double AngleCont
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.AngleCont = value;
+ }
+ }
+ }
- public double SizeBase
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.SizeBase = value;
- }
- }
- }
+ public double SizeBase
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.SizeBase = value;
+ }
+ }
+ }
- public double SizeCont
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.SizeCont = value;
- }
- }
- }
+ public double SizeCont
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.SizeCont = value;
+ }
+ }
+ }
- public double SizeXBase
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.SizeXBase = value;
- }
- }
- }
+ public double SizeXBase
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.SizeXBase = value;
+ }
+ }
+ }
- public double SizeXCont
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.SizeXCont = value;
- }
- }
- }
+ public double SizeXCont
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.SizeXCont = value;
+ }
+ }
+ }
- public double SizeYBase
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.SizeYBase = value;
- }
- }
- }
+ public double SizeYBase
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.SizeYBase = value;
+ }
+ }
+ }
- public double SizeYCont
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.SizeYCont = value;
- }
- }
- }
+ public double SizeYCont
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.SizeYCont = value;
+ }
+ }
+ }
- public bool Dra
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.Dra = value;
- }
- }
- }
+ public bool Dra
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.Dra = value;
+ }
+ }
+ }
- public bool Hit
- {
- set
- {
- foreach (Difs value2 in Difss.Values)
- {
- value2.Hit = value;
- }
- }
- }
+ public bool Hit
+ {
+ set
+ {
+ foreach (Difs value2 in Difss.Values)
+ {
+ value2.Hit = value;
+ }
+ }
+ }
- public Difs JoinRoot => r;
- public IEnumerable EnumAllPar()
- {
- foreach (Difs value in Difss.Values)
- {
- foreach (Par item in value.EnumAllPar())
- {
- yield return item;
- }
- }
- }
+ public Difs JoinRoot => r;
+ public IEnumerable EnumAllPar()
+ {
+ foreach (Difs value in Difss.Values)
+ {
+ foreach (Par item in value.EnumAllPar())
+ {
+ yield return item;
+ }
+ }
+ }
- public void SetDefault()
- {
- foreach (Difs value in Difss.Values)
- {
- value.SetDefault();
- }
- }
+ public void SetDefault()
+ {
+ foreach (Difs value in Difss.Values)
+ {
+ value.SetDefault();
+ }
+ }
- public Obj SetDefaultR()
- {
- foreach (Difs value in Difss.Values)
- {
- value.SetDefault();
- }
- return this;
- }
+ public Obj SetDefaultR()
+ {
+ foreach (Difs value in Difss.Values)
+ {
+ value.SetDefault();
+ }
+ return this;
+ }
- public Obj()
- {
- }
+ public Obj()
+ {
+ }
- public Obj(Obj Obj)
- {
- Copy(Obj);
- }
+ public Obj(Obj Obj)
+ {
+ Copy(Obj);
+ }
- private void Copy(Obj Obj)
- {
- Tag = Obj.Tag;
- foreach (string key in Obj.Difss.Keys)
- {
- Difss.Add(key, new Difs(Obj.Difss[key]));
- }
- }
+ private void Copy(Obj Obj)
+ {
+ Tag = Obj.Tag;
+ foreach (string key in Obj.Difss.Keys)
+ {
+ Difss.Add(key, new Difs(Obj.Difss[key]));
+ }
+ }
- public void Add(string Name, Difs Difs)
- {
- Difss.Add(Name, Difs);
- }
+ public void Add(string Name, Difs Difs)
+ {
+ Difss.Add(Name, Difs);
+ }
- public void Add(Difs Difs)
- {
- Difss.Add(Difs.Tag, Difs);
- }
+ public void Add(Difs Difs)
+ {
+ Difss.Add(Difs.Tag, Difs);
+ }
- public void Insert(int Index, string Name, Difs Difs)
- {
- Difss.Insert(Index, Name, Difs);
- }
+ public void Insert(int Index, string Name, Difs Difs)
+ {
+ Difss.Insert(Index, Name, Difs);
+ }
- public void Remove(string Name)
- {
- Difss.Remove(Name);
- }
+ public void Remove(string Name)
+ {
+ Difss.Remove(Name);
+ }
- public void Draw(Are Are)
- {
- foreach (Difs value in Difss.Values)
- {
- value.Draw(Are);
- }
- }
+ public void Draw(Are Are)
+ {
+ foreach (Difs value in Difss.Values)
+ {
+ value.Draw(Are);
+ }
+ }
- public void Draws(Are Are)
- {
- foreach (Difs value in Difss.Values)
- {
- value.Draws(Are);
- }
- }
+ public void Draws(Are Are)
+ {
+ foreach (Difs value in Difss.Values)
+ {
+ value.Draws(Are);
+ }
+ }
- public void Draw(AreM AreM)
- {
- foreach (Difs value in Difss.Values)
- {
- value.Draw(AreM);
- }
- }
+ public void Draw(AreM AreM)
+ {
+ foreach (Difs value in Difss.Values)
+ {
+ value.Draw(AreM);
+ }
+ }
- public void Draws(AreM AreM)
- {
- foreach (Difs value in Difss.Values)
- {
- value.Draws(AreM);
- }
- }
+ public void Draws(AreM AreM)
+ {
+ foreach (Difs value in Difss.Values)
+ {
+ value.Draws(AreM);
+ }
+ }
- private Difs GetJoinRootDifs()
- {
- Difs[] array = Difss.Values.ToArray();
- if (array.Length <= 1)
- {
- return array.FirstOrDefault();
- }
- Par[] pa = EnumAllPar().ToArray();
- Difs[] array2 = array;
- Vector2D p;
- foreach (Difs difs in array2)
- {
- if (difs.EnumJoinRoot.All(delegate(Par p0)
- {
- p = p0.Position;
- return pa.All((Par p1) => p0 == p1 || p1.JP.All((Joi j) => !(p1.ToGlobal(j.Joint).DistanceSquared(p) <= Join.IdentityDistance)));
- }))
- {
- return difs;
- }
- }
- return array.First();
- }
+ private Difs GetJoinRootDifs()
+ {
+ Difs[] array = Difss.Values.ToArray();
+ if (array.Length <= 1)
+ {
+ return array.FirstOrDefault();
+ }
+ Par[] pa = EnumAllPar().ToArray();
+ Difs[] array2 = array;
+ Vector2D p;
+ foreach (Difs difs in array2)
+ {
+ if (difs.EnumJoinRoot.All(delegate(Par p0)
+ {
+ p = p0.Position;
+ return pa.All((Par p1) => p0 == p1 || p1.JP.All((Joi j) => !(p1.ToGlobal(j.Joint).DistanceSquared(p) <= Join.IdentityDistance)));
+ }))
+ {
+ return difs;
+ }
+ }
+ return array.First();
+ }
- public void SetJoints()
- {
- Difs[] array = Difss.Values.ToArray();
- Difs[] array2 = array;
- for (int i = 0; i < array2.Length; i++)
- {
- array2[i].SetJoints();
- }
- r = GetJoinRootDifs();
- if (r != null)
- {
- jsd = r.GetJointsD(array);
- }
- }
+ public void SetJoints()
+ {
+ Difs[] array = Difss.Values.ToArray();
+ Difs[] array2 = array;
+ for (int i = 0; i < array2.Length; i++)
+ {
+ array2[i].SetJoints();
+ }
+ r = GetJoinRootDifs();
+ if (r != null)
+ {
+ jsd = r.GetJointsD(array);
+ }
+ }
- public void SetJoints(string Name)
- {
- Difs[] array = Difss.Values.ToArray();
- Difs[] array2 = array;
- for (int i = 0; i < array2.Length; i++)
- {
- array2[i].SetJoints();
- }
- r = Difss[Name];
- if (r != null)
- {
- jsd = r.GetJointsD(array);
- }
- }
+ public void SetJoints(string Name)
+ {
+ Difs[] array = Difss.Values.ToArray();
+ Difs[] array2 = array;
+ for (int i = 0; i < array2.Length; i++)
+ {
+ array2[i].SetJoints();
+ }
+ r = Difss[Name];
+ if (r != null)
+ {
+ jsd = r.GetJointsD(array);
+ }
+ }
- public void JoinP()
- {
- if (r != null)
- {
- r.JoinPA();
- jsd.JoinP();
- }
- }
+ public void JoinP()
+ {
+ if (r != null)
+ {
+ r.JoinPA();
+ jsd.JoinP();
+ }
+ }
- public void JoinPA()
- {
- if (r != null)
- {
- r.JoinPA();
- jsd.JoinPA();
- }
- }
+ public void JoinPA()
+ {
+ if (r != null)
+ {
+ r.JoinPA();
+ jsd.JoinPA();
+ }
+ }
- public void JoinPall()
- {
- if (r != null)
- {
- r.JoinPA();
- jsd.JoinPall();
- }
- }
+ public void JoinPall()
+ {
+ if (r != null)
+ {
+ r.JoinPA();
+ jsd.JoinPall();
+ }
+ }
- public void JoinPAall()
- {
- if (r != null)
- {
- r.JoinPA();
- jsd.JoinPAall();
- }
- }
+ public void JoinPAall()
+ {
+ if (r != null)
+ {
+ r.JoinPA();
+ jsd.JoinPAall();
+ }
+ }
- public HashSet GetHitDifsTagsCur(ref Color HitColor)
- {
- HashSet hashSet = new HashSet();
- foreach (Difs value in Values)
- {
- if (value.Current.IsHit(ref HitColor))
- {
- hashSet.Add(value.Tag);
- }
- }
- return hashSet;
- }
+ public HashSet GetHitDifsTagsCur(ref Color HitColor)
+ {
+ HashSet hashSet = new HashSet();
+ foreach (Difs value in Values)
+ {
+ if (value.Current.IsHit(ref HitColor))
+ {
+ hashSet.Add(value.Tag);
+ }
+ }
+ return hashSet;
+ }
- public List GetHitDifssCur(ref Color HitColor)
- {
- List list = new List();
- foreach (Difs value in Values)
- {
- if (value.Current.IsHit(ref HitColor))
- {
- list.Add(value);
- }
- }
- return list;
- }
+ public List GetHitDifssCur(ref Color HitColor)
+ {
+ List list = new List();
+ foreach (Difs value in Values)
+ {
+ if (value.Current.IsHit(ref HitColor))
+ {
+ list.Add(value);
+ }
+ }
+ return list;
+ }
- public HashSet GetHitParTagsCur(ref Color HitColor)
- {
- HashSet hashSet = new HashSet();
- foreach (Difs value in Values)
- {
- foreach (string hitTag in value.Current.GetHitTags(ref HitColor))
- {
- hashSet.Add(hitTag);
- }
- }
- return hashSet;
- }
+ public HashSet GetHitParTagsCur(ref Color HitColor)
+ {
+ HashSet hashSet = new HashSet();
+ foreach (Difs value in Values)
+ {
+ foreach (string hitTag in value.Current.GetHitTags(ref HitColor))
+ {
+ hashSet.Add(hitTag);
+ }
+ }
+ return hashSet;
+ }
- public List GetHitParsCur(ref Color HitColor)
- {
- List list = new List();
- foreach (Difs value in Values)
- {
- list.AddRange(value.Current.GetHitPars(ref HitColor));
- }
- return list;
- }
+ public List GetHitParsCur(ref Color HitColor)
+ {
+ List list = new List();
+ foreach (Difs value in Values)
+ {
+ list.AddRange(value.Current.GetHitPars(ref HitColor));
+ }
+ return list;
+ }
- public bool IsHitCur(ref Color HitColor)
- {
- foreach (Difs value in Values)
- {
- if (value.IsHit(ref HitColor))
- {
- return true;
- }
- }
- return false;
- }
+ public bool IsHitCur(ref Color HitColor)
+ {
+ foreach (Difs value in Values)
+ {
+ if (value.IsHit(ref HitColor))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
- public HashSet GetHitDifsTags(ref Color HitColor)
- {
- HashSet hashSet = new HashSet();
- foreach (Difs value in Values)
- {
- if (value.IsHit(ref HitColor))
- {
- hashSet.Add(value.Tag);
- }
- }
- return hashSet;
- }
+ public HashSet GetHitDifsTags(ref Color HitColor)
+ {
+ HashSet hashSet = new HashSet();
+ foreach (Difs value in Values)
+ {
+ if (value.IsHit(ref HitColor))
+ {
+ hashSet.Add(value.Tag);
+ }
+ }
+ return hashSet;
+ }
- public List GetHitDifss(ref Color HitColor)
- {
- List list = new List();
- foreach (Difs value in Values)
- {
- if (value.IsHit(ref HitColor))
- {
- list.Add(value);
- }
- }
- return list;
- }
+ public List GetHitDifss(ref Color HitColor)
+ {
+ List list = new List();
+ foreach (Difs value in Values)
+ {
+ if (value.IsHit(ref HitColor))
+ {
+ list.Add(value);
+ }
+ }
+ return list;
+ }
- public HashSet GetHitParTags(ref Color HitColor)
- {
- HashSet hashSet = new HashSet();
- foreach (Difs value in Values)
- {
- foreach (string hitTag in value.GetHitTags(ref HitColor))
- {
- hashSet.Add(hitTag);
- }
- }
- return hashSet;
- }
+ public HashSet GetHitParTags(ref Color HitColor)
+ {
+ HashSet hashSet = new HashSet();
+ foreach (Difs value in Values)
+ {
+ foreach (string hitTag in value.GetHitTags(ref HitColor))
+ {
+ hashSet.Add(hitTag);
+ }
+ }
+ return hashSet;
+ }
- public List GetHitPars(ref Color HitColor)
- {
- List list = new List();
- foreach (Difs value in Values)
- {
- list.AddRange(value.GetHitPars(ref HitColor));
- }
- return list;
- }
+ public List GetHitPars(ref Color HitColor)
+ {
+ List list = new List();
+ foreach (Difs value in Values)
+ {
+ list.AddRange(value.GetHitPars(ref HitColor));
+ }
+ return list;
+ }
- public bool IsHit(ref Color HitColor)
- {
- foreach (Difs value in Values)
- {
- if (value.IsHit(ref HitColor))
- {
- return true;
- }
- }
- return false;
- }
+ public bool IsHit(ref Color HitColor)
+ {
+ foreach (Difs value in Values)
+ {
+ if (value.IsHit(ref HitColor))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
- public void Symmetrization(string[] Names)
- {
- Difs[] array = Difss.Values.ToArray();
- Difs[] array2 = array;
- for (int i = 0; i < array2.Length; i++)
- {
- array2[i].SetJoints();
- }
- JointsD jointsD = GetJoinRootDifs().GetJointsD(array);
- foreach (string name in Names)
- {
- symmetrization(name, array, jointsD);
- }
- }
+ public void Symmetrization(string[] Names)
+ {
+ Difs[] array = Difss.Values.ToArray();
+ Difs[] array2 = array;
+ for (int i = 0; i < array2.Length; i++)
+ {
+ array2[i].SetJoints();
+ }
+ JointsD jointsD = GetJoinRootDifs().GetJointsD(array);
+ foreach (string name in Names)
+ {
+ symmetrization(name, array, jointsD);
+ }
+ }
- public void Symmetrization(string Name, string[] Names)
- {
- Difs[] array = Difss.Values.ToArray();
- Difs[] array2 = array;
- for (int i = 0; i < array2.Length; i++)
- {
- array2[i].SetJoints();
- }
- JointsD jointsD = Difss[Name].GetJointsD(array);
- foreach (string name in Names)
- {
- symmetrization(name, array, jointsD);
- }
- }
+ public void Symmetrization(string Name, string[] Names)
+ {
+ Difs[] array = Difss.Values.ToArray();
+ Difs[] array2 = array;
+ for (int i = 0; i < array2.Length; i++)
+ {
+ array2[i].SetJoints();
+ }
+ JointsD jointsD = Difss[Name].GetJointsD(array);
+ foreach (string name in Names)
+ {
+ symmetrization(name, array, jointsD);
+ }
+ }
- private void symmetrization(string Name, Difs[] da, JointsD jsdb)
- {
- Difs difs = Difss[Name];
- JointsD jointsD = difs.GetJointsD(da);
- Difs difs2 = new Difs(difs);
- difs2.SetJoints();
- difs2.ReverseX();
- TagReplace(difs2);
- SetPos(difs2, GetSymPos(difs, jsdb) - difs2.CurJoinRoot.Position);
- foreach (Pars item in difs2.EnumAllPars())
- {
- difs2.JoinP(item);
- }
- Difss.Add(difs2.Tag, difs2);
- string key = null;
- foreach (JointD join in jointsD.Joins)
- {
- difs2 = new Difs(join.Difs1);
- difs2.SetJoints();
- difs2.ReverseX();
- TagReplace(difs2);
- if (join.Difs0.Tag.Contains("左"))
- {
- key = join.Difs0.Tag.Replace("左", "右");
- }
- else if (join.Difs0.Tag.Contains("右"))
- {
- key = join.Difs0.Tag.Replace("右", "左");
- }
- Par par = Difss[key].Current.GetPar(join.Path0);
- SetPos(difs2, par.ToGlobal(par.JP[join.Index].Joint) - difs2.CurJoinRoot.Position);
- foreach (Pars item2 in difs2.EnumAllPars())
- {
- difs2.JoinP(item2);
- }
- Difss.Add(difs2.Tag, difs2);
- }
- }
+ private void symmetrization(string Name, Difs[] da, JointsD jsdb)
+ {
+ Difs difs = Difss[Name];
+ JointsD jointsD = difs.GetJointsD(da);
+ Difs difs2 = new Difs(difs);
+ difs2.SetJoints();
+ difs2.ReverseX();
+ TagReplace(difs2);
+ SetPos(difs2, GetSymPos(difs, jsdb) - difs2.CurJoinRoot.Position);
+ foreach (Pars item in difs2.EnumAllPars())
+ {
+ difs2.JoinP(item);
+ }
+ Difss.Add(difs2.Tag, difs2);
+ string key = null;
+ foreach (JointD join in jointsD.Joins)
+ {
+ difs2 = new Difs(join.Difs1);
+ difs2.SetJoints();
+ difs2.ReverseX();
+ TagReplace(difs2);
+ if (join.Difs0.Tag.Contains("左"))
+ {
+ key = join.Difs0.Tag.Replace("左", "右");
+ }
+ else if (join.Difs0.Tag.Contains("右"))
+ {
+ key = join.Difs0.Tag.Replace("右", "左");
+ }
+ Par par = Difss[key].Current.GetPar(join.Path0);
+ SetPos(difs2, par.ToGlobal(par.JP[join.Index].Joint) - difs2.CurJoinRoot.Position);
+ foreach (Pars item2 in difs2.EnumAllPars())
+ {
+ difs2.JoinP(item2);
+ }
+ Difss.Add(difs2.Tag, difs2);
+ }
+ }
- private void TagReplace(Difs ds)
- {
- if (ds.Tag.Contains("左"))
- {
- ds.Tag = ds.Tag.Replace("左", "右");
- }
- else if (ds.Tag.Contains("右"))
- {
- ds.Tag = ds.Tag.Replace("右", "左");
- }
- }
+ private void TagReplace(Difs ds)
+ {
+ if (ds.Tag.Contains("左"))
+ {
+ ds.Tag = ds.Tag.Replace("左", "右");
+ }
+ else if (ds.Tag.Contains("右"))
+ {
+ ds.Tag = ds.Tag.Replace("右", "左");
+ }
+ }
- private Vector2D GetSymPos(Difs r, JointsD jsdb)
- {
- JointD jointD = null;
- foreach (JointD join in jsdb.Joins)
- {
- if (join.Difs1 == r)
- {
- jointD = join;
- break;
- }
- }
- Vector2D position = r.CurJoinRoot.Position;
- Par par = jointD.Difs0.Current.GetPar(jointD.Path0);
- Joi joi = par.JP[jointD.Index];
- foreach (Joi item in par.JP)
- {
- Vector2D result = par.ToGlobal(item.Joint);
- if (item != joi && System.Math.Abs(result.Y - position.Y) < 1E-06)
- {
- return result;
- }
- }
- return Dat.Vec2DZero;
- }
+ private Vector2D GetSymPos(Difs r, JointsD jsdb)
+ {
+ JointD jointD = null;
+ foreach (JointD join in jsdb.Joins)
+ {
+ if (join.Difs1 == r)
+ {
+ jointD = join;
+ break;
+ }
+ }
+ Vector2D position = r.CurJoinRoot.Position;
+ Par par = jointD.Difs0.Current.GetPar(jointD.Path0);
+ Joi joi = par.JP[jointD.Index];
+ foreach (Joi item in par.JP)
+ {
+ Vector2D result = par.ToGlobal(item.Joint);
+ if (item != joi && System.Math.Abs(result.Y - position.Y) < 1E-06)
+ {
+ return result;
+ }
+ }
+ return Dat.Vec2DZero;
+ }
- private void SetPos(Difs ds, Vector2D v)
- {
- foreach (Par item in ds.EnumAllPar())
- {
- item.PositionBase += v;
- }
- }
+ private void SetPos(Difs ds, Vector2D v)
+ {
+ foreach (Par item in ds.EnumAllPar())
+ {
+ item.PositionBase += v;
+ }
+ }
- public void Dispose()
- {
- foreach (Difs value in Difss.Values)
- {
- value.Dispose();
- }
- }
+ public void Dispose()
+ {
+ foreach (Difs value in Difss.Values)
+ {
+ value.Dispose();
+ }
+ }
+ }
}
diff --git a/2DGAMELIB/_2DGAMELIB/OrderedDictionary.cs b/2DGAMELIB/_2DGAMELIB/OrderedDictionary.cs
index 12018d4..9b7980c 100644
--- a/2DGAMELIB/_2DGAMELIB/OrderedDictionary.cs
+++ b/2DGAMELIB/_2DGAMELIB/OrderedDictionary.cs
@@ -2,205 +2,206 @@ using System;
using System.Collections.Generic;
using System.Linq;
-namespace _2DGAMELIB;
-
-[Serializable]
-public class OrderedDictionary
+namespace _2DGAMELIB
{
- private List keys;
+ [Serializable]
+ public class OrderedDictionary
+ {
+ private List keys;
- private Dictionary values;
+ private Dictionary values;
- public T2 this[T1 Key]
- {
- get
- {
- return values[Key];
- }
- set
- {
- values[Key] = value;
- }
- }
+ public T2 this[T1 Key]
+ {
+ get
+ {
+ return values[Key];
+ }
+ set
+ {
+ values[Key] = value;
+ }
+ }
- public T2 this[int Index]
- {
- get
- {
- return values[keys[Index]];
- }
- set
- {
- values[keys[Index]] = value;
- }
- }
+ public T2 this[int Index]
+ {
+ get
+ {
+ return values[keys[Index]];
+ }
+ set
+ {
+ values[keys[Index]] = value;
+ }
+ }
- public IEnumerable Keys => keys;
+ public IEnumerable Keys => keys;
- public IEnumerable Values
- {
- get
- {
- foreach (T1 key in keys)
- {
- yield return values[key];
- }
- }
- }
+ public IEnumerable Values
+ {
+ get
+ {
+ foreach (T1 key in keys)
+ {
+ yield return values[key];
+ }
+ }
+ }
- public int Count => keys.Count;
+ public int Count => keys.Count;
- public OrderedDictionary()
- {
- keys = new List();
- values = new Dictionary