public SolarSystem() { InitializeComponent(); this.Width = Screen.PrimaryScreen.WorkingArea.Width; this.Height = Screen.PrimaryScreen.WorkingArea.Height; this.DoubleBuffered = true; aTimer = new System.Timers.Timer(1000 / GLOBALS.FPS); aTimer.Elapsed += aTimer_Elapsed; Random r = new Random(GLOBALS.SEED); for (var i = 0; i < GLOBALS.SUNS_NUM; i++) { var o = new obj(i, this.Width, this.Height, r, true); _objects.Add(o); } for (var i = GLOBALS.SUNS_NUM; i < GLOBALS.NUM_OBJECTS + GLOBALS.SUNS_NUM; i++) { var o = new obj(i, this.Width, this.Height, r); _objects.Add(o); } aTimer.Enabled = true; _center.set(this.Width / 2, this.Height / 2, (this.Width + this.Height) / 2); }
public void move() { this.p.x += this.v.x; this.p.y += this.v.y; this.p.z += this.v.z; var tmp = new _3d(); tmp.set(this.p.x, this.p.y, this.p.z); //TAIL this.t.Reverse(); this.t.Add(tmp); this.t.Reverse(); if (this.t.Count > GLOBALS.TAIL_SIZE) { this.t.RemoveRange(GLOBALS.TAIL_SIZE, this.t.Count - GLOBALS.TAIL_SIZE); } }