예제 #1
0
                internal Particle(SimulationView view)
                {
                    this.view = view;
                    // make each particle a bit different by randomizing its
                    // coefficient of friction
                    var r = ((float)(new Random(1)).NextDouble() - 0.5f) * 0.2f;

                    mOneMinusFriction = 1.0f - sFriction + r;
                }
예제 #2
0
        public ParticleSystem(SimulationView view)
        {
            sim_view = view;
            Balls    = new List <Particle> ();

            // Initially our particles have no speed or acceleration
            for (int i = 0; i < NUM_PARTICLES; i++)
            {
                Balls.Add(new Particle(this));
            }
        }
예제 #3
0
                internal ParticleSystem(SimulationView view)
                {
                    this.view = view;

                    /*
                     * Initially our particles have no speed or acceleration
                     */
                    for (int i = 0; i < mBalls.Length; i++)
                    {
                        mBalls[i] = new Particle(view);
                    }
                }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Remove the title bar
			RequestWindowFeature (WindowFeatures.NoTitle);

			// Keep the screen from turning off while we're running
			Window.AddFlags (WindowManagerFlags.KeepScreenOn);

			// Get an instance of the SensorManager
			sensor_manager = (SensorManager)GetSystemService (Activity.SensorService);

			// Get an instance of the WindowManager
			window_manager = GetSystemService (Activity.WindowService).JavaCast<IWindowManager> ();

			// Instantiate our simulation view and set it as the activity's content
			sim_view = new SimulationView (this, sensor_manager, window_manager);
			SetContentView (sim_view);
		}
예제 #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Remove the title bar
            RequestWindowFeature(WindowFeatures.NoTitle);

            // Keep the screen from turning off while we're running
            Window.AddFlags(WindowManagerFlags.KeepScreenOn);

            // Get an instance of the SensorManager
            sensor_manager = (SensorManager)GetSystemService(Activity.SensorService);

            // Get an instance of the WindowManager
            window_manager = GetSystemService(Activity.WindowService).JavaCast <IWindowManager> ();

            // Instantiate our simulation view and set it as the activity's content
            sim_view = new SimulationView(this, sensor_manager, window_manager);
            SetContentView(sim_view);
        }
예제 #6
0
        /// <summary>
        /// Called when the activity is first created. </summary>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Get an instance of the SensorManager
            mSensorManager = (SensorManager)GetSystemService(SENSOR_SERVICE);

            // Get an instance of the PowerManager
            mPowerManager = (PowerManager)GetSystemService(POWER_SERVICE);

            // Get an instance of the WindowManager
            mWindowManager = (IWindowManager)GetSystemService(WINDOW_SERVICE);
            mDisplay = mWindowManager.GetDefaultDisplay();

            // Create a bright wake lock
            mWakeLock = mPowerManager.NewWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, this.GetType().Name);

            // instantiate our simulation view and set it as the activity's content
            mSimulationView = new SimulationView(this);
            SetContentView(mSimulationView);
        }
예제 #7
0
        /// <summary>
        /// Called when the activity is first created. </summary>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Get an instance of the SensorManager
            mSensorManager = (SensorManager)GetSystemService(SENSOR_SERVICE);

            // Get an instance of the PowerManager
            mPowerManager = (PowerManager)GetSystemService(POWER_SERVICE);

            // Get an instance of the WindowManager
            mWindowManager = (IWindowManager)GetSystemService(WINDOW_SERVICE);
            mDisplay       = mWindowManager.DefaultDisplay;

            // Create a bright wake lock
            mWakeLock = mPowerManager.NewWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, this.GetType().Name);

            // instantiate our simulation view and set it as the activity's content
            mSimulationView = new SimulationView(this);
            SetContentView(mSimulationView);
        }
예제 #8
0
 internal ParticleSystem(SimulationView view)
 {
     this.view = view;
     /*
      * Initially our particles have no speed or acceleration
      */
     for (int i = 0; i < mBalls.Length; i++)
     {
         mBalls[i] = new Particle(view);
     }
 }
예제 #9
0
 internal Particle(SimulationView view)
 {
     this.view = view;
     // make each particle a bit different by randomizing its
     // coefficient of friction
     var r = ((float)(new Random(1)).NextDouble() - 0.5f) * 0.2f;
     mOneMinusFriction = 1.0f - sFriction + r;
 }