static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); KBEdit myForm = new KBEdit(); myForm.Show(); myForm.TopMost = true; while (myForm.Looping1) { myForm.Update(); //myForm.update(); myForm.Render(); Application.DoEvents(); } }
public Particle(KBEdit data) { // Floating point conversion commencing lifeCurrent = 0; lifeEnd = (float)(rand.Next((int)data.nMinLife.Value * 1000, (int)data.nMaxLife.Value * 1000) + 1); lifeEnd /= 1000; velocity = (float)data.nVelStart.Value; // Changing Direction (steering) int min, max; if (data.cbDirRangeX.Checked) // If this is checked, we can spawn both left and right directions { if (data.nDirectionX.Value < 0) { min = (int)data.nDirectionX.Value; max = -min; } else { max = (int)data.nDirectionX.Value; min = -max; } } else // particles spawn in only Left or Right direction { if (data.nDirectionX.Value < 0) { min = (int)data.nDirectionX.Value; max = 0; } else { min = 0; max = (int)data.nDirectionX.Value; } } direction.X = (float)rand.Next(min * 1000, (max * 1000) + 1); direction.X /= 1000; if (data.cbDirRangeY.Checked) // If this is checked, we can spawn particles with up AND down movements { if (data.nDirectionY.Value < 0) { min = (int)data.nDirectionY.Value; max = -min; } else { max = (int)data.nDirectionY.Value; min = -max; } } else // All particles will move either up OR down { if (data.nDirectionY.Value < 0) { min = (int)data.nDirectionY.Value; max = 0; } else { min = 0; max = (int)data.nDirectionY.Value; } } direction.Y = rand.Next(min * 1000, (max * 1000) + 1); direction.Y /= 1000; rotation = (float)data.nRotStart.Value; scale = (float)data.nScaleStart.Value; color = data.bColorStart.BackColor; // Change this based on Point, Line, Circle, Rectangle position.X = (int)data.nPosX.Value; position.Y = (int)data.nPosY.Value; int size = (int)data.nSize.Value; if (data.cmbShape.SelectedItem.ToString() == "Line") { position.X += rand.Next(0, size); } else if (data.cmbShape.SelectedItem.ToString() == "Circle") { //float theta = 2 * (float)Math.PI * (float)rand.Next(0, size + 1); float a = rand.Next(0, 1000); a /= 1000; float b = rand.Next(0, 1000); b /= 1000; if (b < a) { float temp = b; b = a; a = temp; } position.X += (b * size * (float)Math.Cos(2 * Math.PI * a / b)); position.Y += (b * size * (float)Math.Sin(2 * Math.PI * a / b)); } else if (data.cmbShape.SelectedItem.ToString() == "Rectangle") { position.X += rand.Next(-size, size); position.Y += rand.Next(-size, size); } }