コード例 #1
0
        /// <summary>
        /// Updates all graphics 60 times per second
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void timer_Tick(object sender, EventArgs e)
        {
            Simulation.Children.Clear();
            foreach (IQuadtreeObject obj in ObjectManager.AllObjects)
            {
                /*Console.WriteLine("Object: " + obj.Name);
                 * Console.WriteLine("Collider position: " + ((CircleCollider)obj.collider).centre.ToString());
                 * Console.WriteLine("Object position: " + obj.position.ToString()); */
                Draw(obj, obj.visuals.size);
                ObjectsViewVelocityPosition.ItemsSource = null;
                ObjectsViewVelocityPosition.ItemsSource = ObjectManager.AllObjects;

                totalTime += (uint)Math.Abs(timeController.currentTimeStep);

                // Update the advanced windows
                foreach (Window window in Application.Current.Windows)
                {
                    if (window.GetType() == typeof(Advanced))
                    {
                        Advanced advanced = (Advanced)window;
                        advanced.CalculateTime();
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Brings up the advanced window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void Advanced_Click(object sender, EventArgs e)
        {
            Advanced advanced = new Advanced();

            advanced.Show();
            if (!(ObjectsView.SelectedItem == null))
            {
                if (ObjectsView.SelectedItem.GetType() == typeof(Star))
                {
                    Star     obj   = ObjectsView.SelectedItem as Star;
                    double[] zones = obj.HabitableZone();

                    advanced.SolarMassOfStarTextBox.Text    = obj.SolarMassOfStar.ToString();
                    advanced.LuminosityOfStarTextBox.Text   = obj.Luminosity.ToString();
                    advanced.HabitableZoneInnerTextBox.Text = (zones[1]).ToString();
                    advanced.HabitableZoneOuterTextBox.Text = (zones[0]).ToString();
                }
            }
        }