diff --git a/LerpCreation.sln b/LerpCreation.sln new file mode 100644 index 0000000..03951c4 --- /dev/null +++ b/LerpCreation.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LerpCreation", "LerpCreation\LerpCreation.csproj", "{F68A246C-480A-4F17-9639-B1AF03DAADF2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F68A246C-480A-4F17-9639-B1AF03DAADF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F68A246C-480A-4F17-9639-B1AF03DAADF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F68A246C-480A-4F17-9639-B1AF03DAADF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F68A246C-480A-4F17-9639-B1AF03DAADF2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/LerpCreation/App.config b/LerpCreation/App.config new file mode 100644 index 0000000..3916e0e --- /dev/null +++ b/LerpCreation/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LerpCreation/LFC.Designer.cs b/LerpCreation/LFC.Designer.cs new file mode 100644 index 0000000..a93c0a6 --- /dev/null +++ b/LerpCreation/LFC.Designer.cs @@ -0,0 +1,406 @@ +namespace LerpCreation +{ + partial class LFC + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint1 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(0D, 0D); + System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint2 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(1D, 1D); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LFC)); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.createStep = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.deleteStep = new System.Windows.Forms.Button(); + this.dupStep = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.ifCheck = new System.Windows.Forms.ComboBox(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.operation = new System.Windows.Forms.ComboBox(); + this.label6 = new System.Windows.Forms.Label(); + this.xVal = new System.Windows.Forms.TextBox(); + this.operationVal = new System.Windows.Forms.TextBox(); + this.label7 = new System.Windows.Forms.Label(); + this.saveStep = new System.Windows.Forms.Button(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.richTextBox2 = new System.Windows.Forms.RichTextBox(); + this.tabControl2 = new System.Windows.Forms.TabControl(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + ((System.ComponentModel.ISupportInitialize) (this.chart1)).BeginInit(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.SuspendLayout(); + // + // chart1 + // + this.chart1.BackColor = System.Drawing.Color.Transparent; + chartArea1.AxisX.LineWidth = 0; + chartArea1.AxisX.MajorGrid.LineColor = System.Drawing.Color.White; + chartArea1.AxisX.Maximum = 1D; + chartArea1.AxisX.Minimum = 0D; + chartArea1.AxisX2.LineColor = System.Drawing.Color.Gray; + chartArea1.AxisY.InterlacedColor = System.Drawing.Color.Black; + chartArea1.CursorX.Interval = 0.1D; + chartArea1.CursorY.Interval = 0.1D; + chartArea1.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea1); + this.chart1.Location = new System.Drawing.Point(-1, 26); + this.chart1.Name = "chart1"; + this.chart1.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.None; + series1.BorderWidth = 4; + series1.ChartArea = "ChartArea1"; + series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline; + series1.Color = System.Drawing.Color.Blue; + series1.CustomProperties = "LineTension=1"; + series1.Name = "Lerp Func"; + series1.Points.Add(dataPoint1); + series1.Points.Add(dataPoint2); + series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; + series1.YAxisType = System.Windows.Forms.DataVisualization.Charting.AxisType.Secondary; + series1.YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; + this.chart1.Series.Add(series1); + this.chart1.Size = new System.Drawing.Size(536, 424); + this.chart1.TabIndex = 0; + this.chart1.Text = "chart"; + // + // listBox1 + // + this.listBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.listBox1.FormattingEnabled = true; + this.listBox1.Location = new System.Drawing.Point(541, 26); + this.listBox1.Name = "listBox1"; + this.listBox1.ScrollAlwaysVisible = true; + this.listBox1.Size = new System.Drawing.Size(256, 52); + this.listBox1.TabIndex = 1; + this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); + // + // createStep + // + this.createStep.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.createStep.Location = new System.Drawing.Point(541, 88); + this.createStep.Name = "createStep"; + this.createStep.Size = new System.Drawing.Size(75, 23); + this.createStep.TabIndex = 2; + this.createStep.Text = "Create Step"; + this.createStep.UseVisualStyleBackColor = true; + this.createStep.Click += new System.EventHandler(this.createStep_Click); + // + // label1 + // + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (0))); + this.label1.Location = new System.Drawing.Point(541, 8); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(100, 15); + this.label1.TabIndex = 3; + this.label1.Text = "Steps"; + // + // deleteStep + // + this.deleteStep.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.deleteStep.Location = new System.Drawing.Point(622, 88); + this.deleteStep.Name = "deleteStep"; + this.deleteStep.Size = new System.Drawing.Size(75, 23); + this.deleteStep.TabIndex = 4; + this.deleteStep.Text = "Delete Step"; + this.deleteStep.UseVisualStyleBackColor = true; + this.deleteStep.Click += new System.EventHandler(this.deleteStep_Click); + // + // dupStep + // + this.dupStep.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.dupStep.Location = new System.Drawing.Point(703, 88); + this.dupStep.Name = "dupStep"; + this.dupStep.Size = new System.Drawing.Size(94, 23); + this.dupStep.TabIndex = 5; + this.dupStep.Text = "Duplicate Step"; + this.dupStep.UseVisualStyleBackColor = true; + this.dupStep.Click += new System.EventHandler(this.dupStep_Click); + // + // label2 + // + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (0))); + this.label2.Location = new System.Drawing.Point(541, 127); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(100, 15); + this.label2.TabIndex = 6; + this.label2.Text = "Instructions"; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(541, 316); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(247, 15); + this.label3.TabIndex = 7; + this.label3.Text = "Output"; + // + // richTextBox1 + // + this.richTextBox1.BackColor = System.Drawing.Color.White; + this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.richTextBox1.Location = new System.Drawing.Point(0, 0); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.ReadOnly = true; + this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; + this.richTextBox1.Size = new System.Drawing.Size(249, 80); + this.richTextBox1.TabIndex = 8; + this.richTextBox1.Text = ""; + // + // ifCheck + // + this.ifCheck.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append; + this.ifCheck.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.ifCheck.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.ifCheck.FormattingEnabled = true; + this.ifCheck.Items.AddRange(new object[] {"LessThan", "GreaterThan", "LessThanOrEqual", "GreaterThanOrEqual"}); + this.ifCheck.Location = new System.Drawing.Point(622, 145); + this.ifCheck.Name = "ifCheck"; + this.ifCheck.Size = new System.Drawing.Size(166, 21); + this.ifCheck.TabIndex = 9; + // + // label4 + // + this.label4.Location = new System.Drawing.Point(541, 148); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(75, 15); + this.label4.TabIndex = 10; + this.label4.Text = "If Check"; + // + // label5 + // + this.label5.Location = new System.Drawing.Point(541, 201); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(75, 15); + this.label5.TabIndex = 12; + this.label5.Text = "Operation"; + // + // operation + // + this.operation.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Append; + this.operation.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.operation.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.operation.FormattingEnabled = true; + this.operation.Items.AddRange(new object[] {"Addition", "Subtraction", "Multiplication", "Division", "Pow", "SquareRoot"}); + this.operation.Location = new System.Drawing.Point(622, 198); + this.operation.Name = "operation"; + this.operation.Size = new System.Drawing.Size(166, 21); + this.operation.TabIndex = 11; + // + // label6 + // + this.label6.Location = new System.Drawing.Point(541, 175); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(75, 15); + this.label6.TabIndex = 13; + this.label6.Text = "Check X Val"; + // + // xVal + // + this.xVal.Location = new System.Drawing.Point(622, 172); + this.xVal.Name = "xVal"; + this.xVal.Size = new System.Drawing.Size(166, 20); + this.xVal.TabIndex = 14; + this.xVal.TextChanged += new System.EventHandler(this.xVal_TextChanged); + // + // operationVal + // + this.operationVal.Location = new System.Drawing.Point(622, 225); + this.operationVal.Name = "operationVal"; + this.operationVal.Size = new System.Drawing.Size(166, 20); + this.operationVal.TabIndex = 16; + this.operationVal.TextChanged += new System.EventHandler(this.operationVal_TextChanged); + // + // label7 + // + this.label7.Location = new System.Drawing.Point(541, 228); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(75, 15); + this.label7.TabIndex = 15; + this.label7.Text = "Operation Val"; + // + // saveStep + // + this.saveStep.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.saveStep.Location = new System.Drawing.Point(541, 255); + this.saveStep.Name = "saveStep"; + this.saveStep.Size = new System.Drawing.Size(75, 23); + this.saveStep.TabIndex = 17; + this.saveStep.Text = "Save Step"; + this.saveStep.UseVisualStyleBackColor = true; + this.saveStep.Click += new System.EventHandler(this.saveStep_Click); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Location = new System.Drawing.Point(541, 334); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(257, 106); + this.tabControl1.TabIndex = 18; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.richTextBox1); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(249, 80); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "C++"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.richTextBox2); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(249, 80); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Lua"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // richTextBox2 + // + this.richTextBox2.BackColor = System.Drawing.Color.White; + this.richTextBox2.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.richTextBox2.Location = new System.Drawing.Point(0, 0); + this.richTextBox2.Name = "richTextBox2"; + this.richTextBox2.ReadOnly = true; + this.richTextBox2.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; + this.richTextBox2.Size = new System.Drawing.Size(249, 80); + this.richTextBox2.TabIndex = 9; + this.richTextBox2.Text = ""; + // + // tabControl2 + // + this.tabControl2.Location = new System.Drawing.Point(541, 338); + this.tabControl2.Name = "tabControl2"; + this.tabControl2.SelectedIndex = 0; + this.tabControl2.Size = new System.Drawing.Size(257, 106); + this.tabControl2.TabIndex = 18; + // + // checkBox1 + // + this.checkBox1.Location = new System.Drawing.Point(23, 12); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(88, 15); + this.checkBox1.TabIndex = 19; + this.checkBox1.Text = "Dark Mode"; + this.checkBox1.UseVisualStyleBackColor = true; + this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); + // + // LFC + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.checkBox1); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.saveStep); + this.Controls.Add(this.operationVal); + this.Controls.Add(this.label7); + this.Controls.Add(this.xVal); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.operation); + this.Controls.Add(this.label4); + this.Controls.Add(this.ifCheck); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.dupStep); + this.Controls.Add(this.deleteStep); + this.Controls.Add(this.label1); + this.Controls.Add(this.createStep); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.chart1); + this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(816, 489); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(816, 489); + this.Name = "LFC"; + this.Text = "Lerp Function Creator"; + ((System.ComponentModel.ISupportInitialize) (this.chart1)).EndInit(); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + } + + private System.Windows.Forms.CheckBox checkBox1; + + private System.Windows.Forms.TabControl tabControl2; + + + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + + private System.Windows.Forms.ComboBox ifCheck; + private System.Windows.Forms.ComboBox operation; + private System.Windows.Forms.Label label4; + + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label5; + + + + + + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.RichTextBox richTextBox1; + private System.Windows.Forms.RichTextBox richTextBox2; + private System.Windows.Forms.TextBox operationVal; + private System.Windows.Forms.TextBox xVal; + private System.Windows.Forms.Button deleteStep; + private System.Windows.Forms.Button dupStep; + + private System.Windows.Forms.Button createStep; + private System.Windows.Forms.Button saveStep; + private System.Windows.Forms.Label label1; + + private System.Windows.Forms.ListBox listBox1; + + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + + #endregion + } +} \ No newline at end of file diff --git a/LerpCreation/LFC.cs b/LerpCreation/LFC.cs new file mode 100644 index 0000000..41ccf9d --- /dev/null +++ b/LerpCreation/LFC.cs @@ -0,0 +1,379 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Windows.Forms.DataVisualization.Charting; + +namespace LerpCreation +{ + public enum Type + { + LessThan = 0, + GreaterThan = 1, + LessThanOrEqual = 2, + GreaterThanOrEqual = 3 + } + + public enum Operation + { + Addition = 0, + Subtraction = 1, + Multiplication = 2, + Division = 3, + Pow = 4, + SquareRt = 5 + } + + public struct LerpStep + { + public int id; + public Type type; + public Operation operation; + // the number that is used for type's check + public double x; + // the number that is used for the operation + public double y; + public bool useT; + } + + public partial class LFC : Form + { + private bool dark = false; + private int id = 0; + + private LerpStep currentStep; + + public List steps = new List(); + + public LFC() + { + InitializeComponent(); + + currentStep = new LerpStep(); + currentStep.id = -1; + + ReshapeGraph(); + } + + double DoOperation(Operation o, double x, double i) + { + switch (o) + { + case Operation.Addition: + return x + i; + case Operation.Subtraction: + return x - i; + case Operation.Multiplication: + return x * i; + case Operation.Division: + return x / i; + case Operation.Pow: + return Math.Pow(x,i); + case Operation.SquareRt: + return Math.Sqrt(x); + } + + return x; + } + void ReshapeGraph() + { + chart1.Series[0].Points.Clear(); + string cpp = "// Includes\n#include \n\ndouble LerpFunc(t) {\n double val = t;\n"; + string lua = "-- Requires math functions to be exposed!\n\nfunction LerpFunc(t)\n local val = t\n"; + if (steps.Count != 0) + { + for (double i = 0; i <= 1.1; i += 0.05) + { + double y = i; + foreach (LerpStep s in steps) + { + double use = s.y; + if (s.useT) + use = i; + switch (s.type) + { + case Type.LessThan: + if (i < s.x) + y = DoOperation(s.operation, y, use); + break; + case Type.GreaterThan: + if (i > s.x) + y = DoOperation(s.operation, y, use); + break; + case Type.LessThanOrEqual: + if (i <= s.x) + y = DoOperation(s.operation, y, use); + break; + case Type.GreaterThanOrEqual: + if (i >= s.x) + y = DoOperation(s.operation, y, use); + break; + } + } + chart1.Series[0].Points.AddXY(i, y); + } + + foreach (LerpStep s in steps) + { + string use = s.y.ToString(CultureInfo.CurrentCulture); + if (s.useT) + use = "val"; + switch (s.type) + { + case Type.LessThan: + cpp += " if (x < " + s.x + ")\n val "; + lua += " if x < " + s.x + " then\n val "; + break; + case Type.GreaterThan: + cpp += " if (x > " + s.x + ")\n val "; + lua += " if x > " + s.x + " then\n val "; + break; + case Type.LessThanOrEqual: + cpp += " if (x <= " + s.x + ")\n val "; + lua += " if x <= " + s.x + " then\n val "; + break; + case Type.GreaterThanOrEqual: + cpp += " if (x >= " + s.x + ")\n val "; + lua += " if x >= " + s.x + " then\n val "; + break; + } + + switch (s.operation) + { + case Operation.Addition: + cpp += "+= " + use + ";\n"; + lua += "= val + " + use + "\n end\n"; + break; + case Operation.Subtraction: + cpp += "-= " + use + ";\n"; + lua += "= val - " + use + "\n end\n"; + break; + case Operation.Multiplication: + cpp += "*= " + use + ";\n"; + lua += "= val *" + use + "\n end\n"; + break; + case Operation.Division: + cpp += "/= " + use + ";\n"; + lua += "= val / " + use + "\n end\n"; + break; + case Operation.Pow: + cpp += "= val^" + use + ";\n"; + lua += "= val^" + use + "\n end\n"; + break; + case Operation.SquareRt: + cpp += "= sqrt(val);\n"; + lua += "= math.sqrt(val)\n end\n"; + break; + } + } + } + else + { + chart1.Series[0].Points.AddXY(0, 0); + chart1.Series[0].Points.AddXY(1, 1); + } + + cpp += " return val;\n}"; + lua += " return val\nend"; + richTextBox1.Text = cpp; + richTextBox2.Text = lua; + } + + void fSaveStep(LerpStep st, bool delete = false) + { + foreach (LerpStep s in steps) + if (s.id == st.id) + { + steps.Remove(s); + break; + } + + if (!delete) + steps.Add(st); + + steps.Sort((x, y) => x.x.CompareTo(y.x)); + + listBox1.Items.Clear(); + + foreach (LerpStep step in steps) + { + string ifch = step.type.ToString(); + string op = step.operation.ToString(); + + listBox1.Items.Add(ifch + "|" + op + "| t: " + step.x); + } + + ReshapeGraph(); + } + + private void createStep_Click(object sender, EventArgs e) + { + LerpStep st = new LerpStep(); + st.operation = Operation.Addition; + st.type = Type.LessThan; + st.x = 0; + st.y = 0; + st.id = id; + st.useT = false; + id++; + + currentStep = st; + + fSaveStep(st); + + } + + private void xVal_TextChanged(object sender, EventArgs e) + { + TextBox b = (TextBox) sender; + b.Text = Regex.Replace(b.Text, "[^0-9.]", ""); + } + + private void operationVal_TextChanged(object sender, EventArgs e) + { + TextBox b = (TextBox) sender; + if (b.Text != "t") + b.Text = Regex.Replace(b.Text, "[^0-9.]", ""); + } + + private void deleteStep_Click(object sender, EventArgs e) + { + fSaveStep(currentStep, true); + currentStep = new LerpStep(); + currentStep.id = -1; + } + + private void dupStep_Click(object sender, EventArgs e) + { + LerpStep s = currentStep; + s.id = id; + id++; + fSaveStep(s); + currentStep = s; + } + + private void saveStep_Click(object sender, EventArgs e) + { + if (currentStep.id == -1) + return; + + switch (ifCheck.Text) + { + case "LessThan": + currentStep.type = Type.LessThan; + break; + case "GreaterThan": + currentStep.type = Type.GreaterThan; + break; + case "LessThanOrEqual": + currentStep.type = Type.LessThanOrEqual; + break; + case "GreaterThanOrEqual": + currentStep.type = Type.GreaterThanOrEqual; + break; + default: + currentStep.type = Type.LessThan; + break; + } + switch (operation.Text) + { + case "Addition": + currentStep.operation = Operation.Addition; + break; + case "Subtraction": + currentStep.operation = Operation.Subtraction; + break; + case "Multiplication": + currentStep.operation = Operation.Multiplication; + break; + case "Division": + currentStep.operation = Operation.Division; + break; + case "Pow": + currentStep.operation = Operation.Pow; + break; + case "SquareRoot": + currentStep.operation = Operation.SquareRt; + break; + default: + currentStep.operation = Operation.Addition; + break; + } + + if (xVal.Text.Length > 0) + currentStep.x = double.Parse(xVal.Text); + if (operationVal.Text == "t") + currentStep.useT = true; + else if (operationVal.Text.Length > 0) + { + currentStep.useT = false; + currentStep.y = double.Parse(operationVal.Text); + } + + fSaveStep(currentStep); + } + + private void listBox1_SelectedIndexChanged(object sender, EventArgs e) + { + currentStep = steps[((ListBox) sender).SelectedIndex]; + } + + // dark mode (too lazy to rename) + private void checkBox1_CheckedChanged(object sender, EventArgs e) + { + if (!dark) + { + foreach (Control c in Controls) + { + c.ForeColor = Color.White; + c.BackColor = Color.Black; + } + ForeColor = Color.White; + BackColor = Color.Black; + richTextBox1.ForeColor = Color.White; + richTextBox1.BackColor = Color.Black; + richTextBox2.ForeColor = Color.White; + richTextBox2.BackColor = Color.Black; + chart1.ChartAreas[0].BackColor = Color.FromArgb(8,8,8); + foreach (Axis a in chart1.ChartAreas[0].Axes) + { + a.MajorGrid.LineColor = Color.White; + a.MinorGrid.LineColor = Color.White; + a.LabelStyle.ForeColor = Color.White; + a.LineColor = Color.White; + } + } + else + { + foreach (Control c in Controls) + { + c.ForeColor = Color.Black; + c.BackColor = Color.White; + } + ForeColor = Color.Black; + BackColor = Color.White; + richTextBox1.ForeColor = Color.Black; + richTextBox1.BackColor = Color.White; + richTextBox2.ForeColor = Color.Black; + richTextBox2.BackColor = Color.White; + chart1.ChartAreas[0].BackColor = Color.White; + foreach (Axis a in chart1.ChartAreas[0].Axes) + { + a.MajorGrid.LineColor = Color.Black; + a.MinorGrid.LineColor = Color.Black; + a.LabelStyle.ForeColor = Color.Black; + a.LineColor = Color.Black; + } + } + + dark = !dark; + } + } +} diff --git a/LerpCreation/LFC.resx b/LerpCreation/LFC.resx new file mode 100644 index 0000000..4442a35 --- /dev/null +++ b/LerpCreation/LFC.resx @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAQEAAAAEAIADpAwAAFgAAAIlQTkcNChoKAAAADUlIRFIAAABAAAAAQAgDAAAAnbeB7AAAAAFz + UkdCAdnJLH8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAEdUExURQAAAAAA/wAA/wAA/wAA/wAA/wAA/wAA + /wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA + /wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA + /wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA + /wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA/wAA + /wAA/wAA/wAA/wAA/wAA/wAA/wAA/1AYYagAAABfdFJOUwADBg8eNleBwvz/VX+/NH65+ge4+RAft/68 + zzfA+9SIWIpgwdeLPdUkvtETCc5ePBIiAdPQ0r1UfLT4tvfZu9uNYdxjP9glHA0zUnuwsvbejnmz4GRA + r6713eGQ5GZCZKY1SQAAAfpJREFUeJyl1mtDAUEUBuDZhAy5JyRauUQq2Yqii0pCSfeL6v//jGbWzlh9 + cs7s92fOzLtnzi4hiEdbcCw6Xe4lD6UU7b2+Ze4xC3Dv9waCIYpbQAvz+oFIlOIW0MIrMeZXLR9HeZcv + YXmaRPg1ly+1btVPZ6DeEVvbcAtP03oW5hdMv+mxfC6fLUDrO22+yPwWyPPzu0uWj5d15rdhnuVfCs34 + Cri+8DuZ3b2takWb38/kb/r9alirzesn+afE+ZMI77R5A+75/S+peZk/LVv5AX1C9O+BWR/trfzxHpH/ + zP7Laj5u6Gr1D/Us/Pxsftt8AerZ/D7y2Dz0/fvrjUhI0Yv5W8b54xPZf/D8mG+2RP/o8P7zextNsf+0 + +f6A73/6/aOnfP7C/Znw5xdtcH5OV0D23+XF1TWbv+j+7TB/o+TbSj6XR3jv1BsoH0iI/jcm3y/o/UvM + 3B94faX7Z+8/A+dl/yHr2+ankuf3Tyn/Th7lZf6s/1A+Kn0WdP9q/+anAdw/813mg+L/OQ3e/2231x8E + Zf7w83N/HMXnz/1dS3pYfWLmN7gf2uYPyBPTN8X3pwj2pNurD+T9uQTOT/6w88vvz8MI7kn/8Unk9zx6 + eQV78vgm/DnKk/cP0f+jK4wnQ1kfcX7+WP4TWV8s8DVGnV8u8D3++UX6P1tUiGJRPb5yAAAAAElFTkSu + QmCC + + + \ No newline at end of file diff --git a/LerpCreation/LerpCreation.csproj b/LerpCreation/LerpCreation.csproj new file mode 100644 index 0000000..8d8db80 --- /dev/null +++ b/LerpCreation/LerpCreation.csproj @@ -0,0 +1,85 @@ + + + + + Debug + AnyCPU + {F68A246C-480A-4F17-9639-B1AF03DAADF2} + WinExe + LerpCreation + LerpCreation + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + Form + + + LFC.cs + + + + + LFC.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/LerpCreation/Program.cs b/LerpCreation/Program.cs new file mode 100644 index 0000000..f970c08 --- /dev/null +++ b/LerpCreation/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace LerpCreation +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new LFC()); + } + } +} \ No newline at end of file diff --git a/LerpCreation/Properties/AssemblyInfo.cs b/LerpCreation/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a2f6a3b --- /dev/null +++ b/LerpCreation/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("LerpCreation")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LerpCreation")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("F68A246C-480A-4F17-9639-B1AF03DAADF2")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/LerpCreation/Properties/Resources.Designer.cs b/LerpCreation/Properties/Resources.Designer.cs new file mode 100644 index 0000000..28c2893 --- /dev/null +++ b/LerpCreation/Properties/Resources.Designer.cs @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LerpCreation.Properties +{ + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", + "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", + "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState + .Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = + new global::System.Resources.ResourceManager("LerpCreation.Properties.Resources", + typeof(Resources).Assembly); + resourceMan = temp; + } + + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState + .Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get { return resourceCulture; } + set { resourceCulture = value; } + } + } +} \ No newline at end of file diff --git a/LerpCreation/Properties/Resources.resx b/LerpCreation/Properties/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/LerpCreation/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LerpCreation/Properties/Settings.Designer.cs b/LerpCreation/Properties/Settings.Designer.cs new file mode 100644 index 0000000..6b495e1 --- /dev/null +++ b/LerpCreation/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace LerpCreation.Properties +{ + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute( + "Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + private static Settings defaultInstance = + ((Settings) (global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get { return defaultInstance; } + } + } +} \ No newline at end of file diff --git a/LerpCreation/Properties/Settings.settings b/LerpCreation/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/LerpCreation/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/LerpCreation/lIcon.ico b/LerpCreation/lIcon.ico new file mode 100644 index 0000000..e4cc51c Binary files /dev/null and b/LerpCreation/lIcon.ico differ