linting 3
This commit is contained in:
@@ -34,14 +34,6 @@ namespace _2DGAMELIB
|
||||
|
||||
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;
|
||||
|
||||
@@ -47,6 +47,5 @@ namespace _2DGAMELIB
|
||||
Pars.DrawH(hitUnit, gh);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,6 @@ namespace _2DGAMELIB
|
||||
|
||||
public Par Frame1 => frame1;
|
||||
|
||||
public Par Frame2 => frame2;
|
||||
|
||||
public Par Gauge => gauge;
|
||||
|
||||
public Par Knob => knob;
|
||||
@@ -288,7 +286,7 @@ namespace _2DGAMELIB
|
||||
base_ = new Par
|
||||
{
|
||||
Tag = Name + "_ベース",
|
||||
InitializeOP = new Out[1] { Shas.Get正方形() },
|
||||
InitializeOP = new Out[1] { Shas.GetSquare() },
|
||||
PositionBase = Position,
|
||||
SizeBase = Size,
|
||||
SizeXBase = Width,
|
||||
@@ -302,7 +300,7 @@ namespace _2DGAMELIB
|
||||
frame1 = new Par
|
||||
{
|
||||
Tag = Name + "_フレーム1",
|
||||
InitializeOP = new Out[1] { Shas.Get正方形() },
|
||||
InitializeOP = new Out[1] { Shas.GetSquare() },
|
||||
PositionBase = Position,
|
||||
SizeBase = Size,
|
||||
SizeXBase = Width * GetWidthMag(),
|
||||
@@ -317,7 +315,7 @@ namespace _2DGAMELIB
|
||||
frame2 = new Par
|
||||
{
|
||||
Tag = Name + "_フレーム2",
|
||||
InitializeOP = new Out[1] { Shas.Get正方形() },
|
||||
InitializeOP = new Out[1] { Shas.GetSquare() },
|
||||
PositionBase = Position,
|
||||
SizeBase = Size,
|
||||
SizeXBase = Width * GetWidthMag(),
|
||||
@@ -331,7 +329,7 @@ namespace _2DGAMELIB
|
||||
gauge = new Par
|
||||
{
|
||||
Tag = Name + "_ゲージ",
|
||||
InitializeOP = new Out[1] { Shas.Get正方形() },
|
||||
InitializeOP = new Out[1] { Shas.GetSquare() },
|
||||
PositionBase = GetGaugePosition(),
|
||||
SizeBase = Size,
|
||||
SizeXBase = Width * GetWidthMag() * GetGaugeWidthMag(Margin),
|
||||
@@ -345,7 +343,7 @@ namespace _2DGAMELIB
|
||||
this.knob = new Par
|
||||
{
|
||||
Tag = Name + "_ノブ",
|
||||
InitializeOP = new Out[1] { Shas.Get正方形() },
|
||||
InitializeOP = new Out[1] { Shas.GetSquare() },
|
||||
SizeBase = Size,
|
||||
SizeXBase = GetKnobWidthMag(Width),
|
||||
SizeYBase = GetKnobHeightMag(Height),
|
||||
|
||||
@@ -7,14 +7,10 @@ namespace _2DGAMELIB
|
||||
{
|
||||
private ParT parT;
|
||||
|
||||
private Med Med;
|
||||
|
||||
private Are Are;
|
||||
|
||||
private double Width;
|
||||
|
||||
private bool Input;
|
||||
|
||||
private double Min;
|
||||
|
||||
public ParT ParT => parT;
|
||||
@@ -27,11 +23,7 @@ namespace _2DGAMELIB
|
||||
}
|
||||
set
|
||||
{
|
||||
//TODO fix?
|
||||
//if (!Med.BaseControl.Contains(tb))
|
||||
{
|
||||
SetText(value);
|
||||
}
|
||||
SetText(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,48 +33,52 @@ namespace _2DGAMELIB
|
||||
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)
|
||||
public Lab(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)
|
||||
{
|
||||
//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);
|
||||
Setting(Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor);
|
||||
}
|
||||
|
||||
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)
|
||||
public Lab(Are Are, string Name, Vector2D Position, double Size, double Width, Font Font, double TextSize, string Text, Color TextColor, Color ShadColor, Color BackColor, Color FramColor)
|
||||
{
|
||||
Setting(Med, Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor, Input);
|
||||
Setting(Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor);
|
||||
}
|
||||
|
||||
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)
|
||||
private void Setting(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)
|
||||
{
|
||||
this.Med = Med;
|
||||
this.Are = Are;
|
||||
this.Width = Width;
|
||||
this.Input = Input;
|
||||
|
||||
Out[] array = new Out[1] { Shas.Get正方形() };
|
||||
Out[] array = new Out[1] { Shas.GetSquare() };
|
||||
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,
|
||||
|
||||
|
||||
Tag = Name,
|
||||
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);
|
||||
@@ -111,6 +107,8 @@ namespace _2DGAMELIB
|
||||
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);
|
||||
@@ -120,11 +118,6 @@ namespace _2DGAMELIB
|
||||
public void Dispose()
|
||||
{
|
||||
parT.Dispose();
|
||||
if (Input)
|
||||
{
|
||||
//TODO fix?
|
||||
//((Control)Med.BaseControl).Resize -= Lab_Resize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace _2DGAMELIB
|
||||
|
||||
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));
|
||||
labs.Add(Name, new Lab(Are, Name, ref Position, Size, Width, Font, TextSize, Text, ref TextColor, ref ShadColor, ref BackColor, ref FramColor));
|
||||
}
|
||||
|
||||
public void Draw(Are Are)
|
||||
|
||||
@@ -65,14 +65,6 @@ namespace _2DGAMELIB
|
||||
Color.Black
|
||||
};
|
||||
|
||||
private const int LOGPIXELSX = 88;
|
||||
|
||||
private const int LOGPIXELSY = 90;
|
||||
|
||||
public static double dpiX;
|
||||
|
||||
public static double dpiY;
|
||||
|
||||
public static double DpiX;
|
||||
|
||||
public static double DpiY;
|
||||
@@ -83,12 +75,6 @@ namespace _2DGAMELIB
|
||||
|
||||
//public Control BaseControlC => baseControl;
|
||||
|
||||
public GlImage BaseControl => baseControl;
|
||||
|
||||
public double ResMag => resMag;
|
||||
|
||||
public Vector2D ResVector => resVector;
|
||||
|
||||
public string Mode
|
||||
{
|
||||
get
|
||||
@@ -320,30 +306,28 @@ namespace _2DGAMELIB
|
||||
{
|
||||
baseControl.BitmapSetting(BD);
|
||||
Modes[mode].Setting();
|
||||
double FPS = 0.0;
|
||||
|
||||
|
||||
Action action = delegate
|
||||
{
|
||||
FPS = FPSF.Value;
|
||||
if (FPS > 1.0)
|
||||
if (FPSF.Value > 1.0)
|
||||
{
|
||||
Modes[mode].Draw(FPSF);
|
||||
}
|
||||
|
||||
if (ShowFPS)
|
||||
{
|
||||
baseControl.SetTitle(UITitle + " - FPS: " + System.Math.Round(FPSF.Value, 2));
|
||||
}
|
||||
}
|
||||
|
||||
GD.DrawImage(BH, new Point(0, 0));
|
||||
baseControl.SetBitmap(BD);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
while (Drive)
|
||||
{
|
||||
FPSF.FPSFixed(action);
|
||||
|
||||
if (ShowFPS)
|
||||
{
|
||||
baseControl.SetTitle(UITitle + " - FPS: " + System.Math.Round(FPSF.Value, 2));
|
||||
}
|
||||
baseControl.PollEvents();
|
||||
}
|
||||
}
|
||||
@@ -428,20 +412,6 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace _2DGAMELIB
|
||||
[NonSerialized, JsonIgnore]
|
||||
private Brush brusht = new SolidBrush(Color.Black);
|
||||
|
||||
|
||||
//unused
|
||||
private const double Shift = 1.0;
|
||||
|
||||
[NonSerialized, JsonIgnore]
|
||||
@@ -67,6 +69,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private CharacterRange[] crr = new CharacterRange[1];
|
||||
|
||||
//unused
|
||||
private CharacterRange[] cre = new CharacterRange[1];
|
||||
|
||||
public Font Font
|
||||
@@ -171,19 +174,6 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2D PositionT
|
||||
{
|
||||
get
|
||||
{
|
||||
return positionT;
|
||||
}
|
||||
set
|
||||
{
|
||||
positionT = value;
|
||||
EditT = true;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2D RectSize
|
||||
{
|
||||
get
|
||||
@@ -210,7 +200,6 @@ namespace _2DGAMELIB
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public ParT(ParT ParT)
|
||||
{
|
||||
CopyT(ParT);
|
||||
|
||||
@@ -5,85 +5,7 @@ namespace _2DGAMELIB
|
||||
{
|
||||
public static class Shas
|
||||
{
|
||||
public static readonly double D3 = 1.0 / 3.0;
|
||||
|
||||
public static readonly double D3_2 = 2.0 / 3.0;
|
||||
|
||||
public static Vector2D 左端上端 = Dat.Vec2DZero;
|
||||
|
||||
public static Vector2D 中央上端 = new Vector2D(0.5, 0.0);
|
||||
|
||||
public static Vector2D 左寄上端 = new Vector2D(D3, 0.0);
|
||||
|
||||
public static Vector2D 右寄上端 = new Vector2D(D3_2, 0.0);
|
||||
|
||||
public static Vector2D 右端上端 = new Vector2D(1.0, 0.0);
|
||||
|
||||
public static Vector2D 左端中央 = new Vector2D(0.0, 0.5);
|
||||
|
||||
public static Vector2D 中央中央 = new Vector2D(0.5, 0.5);
|
||||
|
||||
public static Vector2D 左寄中央 = new Vector2D(D3, 0.5);
|
||||
|
||||
public static Vector2D 右寄中央 = new Vector2D(D3_2, 0.5);
|
||||
|
||||
public static Vector2D 右端中央 = new Vector2D(1.0, 0.5);
|
||||
|
||||
public static Vector2D 左端上寄 = new Vector2D(0.0, D3);
|
||||
|
||||
public static Vector2D 中央上寄 = new Vector2D(0.5, D3);
|
||||
|
||||
public static Vector2D 左寄上寄 = new Vector2D(D3, D3);
|
||||
|
||||
public static Vector2D 右寄上寄 = new Vector2D(D3_2, D3);
|
||||
|
||||
public static Vector2D 右端上寄 = new Vector2D(1.0, D3);
|
||||
|
||||
public static Vector2D 左端下寄 = new Vector2D(0.0, D3_2);
|
||||
|
||||
public static Vector2D 中央下寄 = new Vector2D(0.5, D3_2);
|
||||
|
||||
public static Vector2D 左寄下寄 = new Vector2D(D3, D3_2);
|
||||
|
||||
public static Vector2D 右寄下寄 = new Vector2D(D3_2, D3_2);
|
||||
|
||||
public static Vector2D 右端下寄 = new Vector2D(1.0, D3_2);
|
||||
|
||||
public static Vector2D 左端下端 = new Vector2D(0.0, 1.0);
|
||||
|
||||
public static Vector2D 中央下端 = new Vector2D(0.5, 1.0);
|
||||
|
||||
public static Vector2D 左寄下端 = new Vector2D(D3, 1.0);
|
||||
|
||||
public static Vector2D 右寄下端 = new Vector2D(D3_2, 1.0);
|
||||
|
||||
public static Vector2D 右端下端 = Dat.Vec2DOne;
|
||||
|
||||
private static MatrixD m120 = 120.0.ToRadian().RotationZ();
|
||||
|
||||
private static MatrixD m240 = 240.0.ToRadian().RotationZ();
|
||||
|
||||
public static Vector2D TP1 = 中央上端;
|
||||
|
||||
public static Vector2D TP2 = GetTP2();
|
||||
|
||||
public static Vector2D TP3 = GetTP3();
|
||||
|
||||
public static Vector2D TP1_2 = (TP1 + TP2) * 0.5;
|
||||
|
||||
public static Vector2D TP2_3 = (TP2 + TP3) * 0.5;
|
||||
|
||||
public static Vector2D TP3_1 = (TP3 + TP1) * 0.5;
|
||||
|
||||
private static Vector2D GetTP2()
|
||||
{
|
||||
return Math.TransformCoordinateBP(ref TP1, ref 中央中央, ref m120);
|
||||
}
|
||||
|
||||
private static Vector2D GetTP3()
|
||||
{
|
||||
return Math.TransformCoordinateBP(ref TP1, ref 中央中央, ref m240);
|
||||
}
|
||||
//rectangle coords
|
||||
|
||||
public static Vector2D MulX(this Vector2D Vector, double X)
|
||||
{
|
||||
@@ -97,13 +19,6 @@ namespace _2DGAMELIB
|
||||
return Vector;
|
||||
}
|
||||
|
||||
public static Vector2D MulXY(this Vector2D Vector, double X, double Y)
|
||||
{
|
||||
Vector.X *= X;
|
||||
Vector.Y *= Y;
|
||||
return Vector;
|
||||
}
|
||||
|
||||
public static Vector2D AddX(this Vector2D Point, double X)
|
||||
{
|
||||
Point.X += X;
|
||||
@@ -537,8 +452,18 @@ namespace _2DGAMELIB
|
||||
}
|
||||
}
|
||||
|
||||
public static Out Get三角形()
|
||||
public static Out GetTriangle()
|
||||
{
|
||||
|
||||
MatrixD m120 = 120.0.ToRadian().RotationZ();
|
||||
MatrixD m240 = 240.0.ToRadian().RotationZ();
|
||||
|
||||
|
||||
Vector2D TP1 = new Vector2D(0.5, 0.0);
|
||||
Vector2D TP2 = Math.TransformCoordinateBP(TP1, new Vector2D(0.5, 0.5), m120);
|
||||
Vector2D TP3 = Math.TransformCoordinateBP(TP1, new Vector2D(0.5, 0.5), m240);
|
||||
|
||||
|
||||
return new Out
|
||||
{
|
||||
Tension = 0f,
|
||||
@@ -546,12 +471,17 @@ namespace _2DGAMELIB
|
||||
};
|
||||
}
|
||||
|
||||
public static Out Get正方形()
|
||||
public static Out GetSquare()
|
||||
{
|
||||
return new Out
|
||||
{
|
||||
Tension = 0f,
|
||||
ps = { 左端上端, 右端上端, 右端下端, 左端下端 }
|
||||
ps = {
|
||||
new Vector2D(0.0, 0.0),
|
||||
new Vector2D(1.0, 0.0),
|
||||
new Vector2D(1.0, 1.0),
|
||||
new Vector2D(0.0, 1.0)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace _2DGAMELIB
|
||||
private void SetParT(string Name, ref Vector2D Position, double Size, double Width, double Height, Font Font, double TextSize, string Text, ref Color TextColor, ref Color ShadColor, ref Color BackColor)
|
||||
{
|
||||
pars = new Pars();
|
||||
Out[] array = new Out[1] { Shas.Get正方形() };
|
||||
Out[] array = new Out[1] { Shas.GetSquare() };
|
||||
array.OutlineFalse();
|
||||
parT = new ParT
|
||||
{
|
||||
@@ -231,7 +231,7 @@ namespace _2DGAMELIB
|
||||
|
||||
private void SetFeed(string Name, double Size, ref Color FeedColor)
|
||||
{
|
||||
Out[] array = new Out[1] { Shas.Get三角形() };
|
||||
Out[] array = new Out[1] { Shas.GetTriangle() };
|
||||
feed = new Par
|
||||
{
|
||||
Tag = Name + "_Feed",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
|
||||
|
||||
namespace _2DGAMELIB
|
||||
{
|
||||
[Serializable]
|
||||
@@ -15,4 +16,4 @@ namespace _2DGAMELIB
|
||||
this.v2 = v2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,33 @@ namespace _2DGAMELIB
|
||||
|
||||
public static class Math
|
||||
{
|
||||
public static ulong overflow_add(this ulong u0, ulong u1)
|
||||
{
|
||||
checked
|
||||
{
|
||||
try
|
||||
{
|
||||
if (u0 + u1 > 9999999999999L)
|
||||
{
|
||||
return 9999999999999uL;
|
||||
}
|
||||
return u0 + u1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return 9999999999999uL;
|
||||
}
|
||||
}
|
||||
}
|
||||
public static ulong underflow_subtract(this ulong u0, ulong u1)
|
||||
{
|
||||
if (u0 < u1)
|
||||
{
|
||||
return 0uL;
|
||||
}
|
||||
return u0 - u1;
|
||||
}
|
||||
|
||||
public static double RoundDown(this double Value, int Digits)
|
||||
{
|
||||
double num = System.Math.Pow(10.0, Digits);
|
||||
|
||||
Reference in New Issue
Block a user