Example #1
0
        } //call WarpSpace function

        private static void Drawstars_White_Update()
        {
            g.Clear(Color.Black);
            for (int i = 0; i < pp.Length; i++)
            {
                int px = (int)(drawspace.Width / 2 + (float)Math.Sin(pp[i].angle) * (pp[i].length + acceleration[i]));
                int py = (int)(drawspace.Height / 2 + (float)Math.Cos(pp[i].angle) * (pp[i].length + acceleration[i]));
                int z1 = (int)(z + 0.012f * Math.Abs(py - drawspace.Height / 2));
                // g.FillEllipse(Brushes.White, px - z1 / 2, py - z1 / 2, z1, z1);
                if (index[i] > 0)
                {
                    g.DrawLine(new Pen(new SolidBrush(Color.FromArgb(((int)(index[i] * 100) % 255), 255, 255, 255)), 2), (int)(drawspace.Width / 2 + (float)Math.Sin(pp[i].angle) * (pp[i].length + 0.7f * acceleration[i])), (int)(drawspace.Height / 2 + (float)Math.Cos(pp[i].angle) * (pp[i].length + 0.7f * acceleration[i])), px, py);
                }

                // tempx[i] = px;
                // tempy[i] = py;
                acceleration[i] = (float)Math.Pow(Math.E, Math.Sqrt(contor[i]));
                contor[i]      += 0.9f;



                if (px > (drawspace.Width + 120) || py > (drawspace.Height + 120) || (px > (drawspace.Width + 120) && py > (drawspace.Height + 120)) || px < -120 || py < -120 || (px < -120 && py < -120))
                {
                    acceleration[i] = 0;
                    contor[i]       = 2.5f;
                    index[i]        = -1;
                    float angle  = (rand.Next(360) * (float)Math.PI) / 180;
                    int   length = rand.Next(1, 300);
                    pp[i] = new Starclass(angle, length);
                }
                index[i]++;
            }
            Updatebackground(drawspace, map);
        } //update for warpspace
Example #2
0
        } //update for warpspace

        public static void DrawStars_White(int nr)
        {
            g = Graphics.FromImage(map);
            g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            drawspace.BackColor = Color.Black;
            pp           = new Starclass[nr];
            tempx        = new float[nr];
            tempy        = new float[nr];
            acceleration = new float[nr];
            contor       = new float[nr];
            index        = new float[nr];
            z            = 3;
            for (int i = 0; i < nr; i++)
            {
                float angle  = (rand.Next(360) * (float)Math.PI) / 180;
                int   length = rand.Next(1, 300);
                pp[i] = new Starclass(angle, length);
                g.FillEllipse(Brushes.White, middle.X + (float)Math.Sin(angle) * length, middle.Y + (float)Math.Cos(angle) * length, z, z);
            }
            time.Interval = 15;
            Update_func[Search_tag("drawspace_white")].torun = true;
        } //call WarpSpace function