public PlatformerGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; #if WINDOWS_PHONE graphics.IsFullScreen = true; TargetElapsedTime = TimeSpan.FromTicks(333333); #endif Accelerometer.Initialize(); }
public ТravelerDiamondsGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.HardwareModeSwitch = false; graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 480; graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight; Accelerometer.Initialize(); }
private async void TheButton_Click(object sender, RoutedEventArgs e) { initialize.IsEnabled = false; stopButton.IsEnabled = true; acc = new Accelerometer(); acc.SensorValueChanged += SensorValueChanged; await acc.Initialize(); await acc.EnableSensor(); await acc.SetReadPeriod(10); await acc.EnableNotifications(); }
public PlatformerGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; #if WINDOWS_PHONE TargetElapsedTime = TimeSpan.FromTicks(333333); #endif graphics.IsFullScreen = true; //graphics.PreferredBackBufferWidth = 800; //graphics.PreferredBackBufferHeight = 480; graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight; Accelerometer.Initialize(); }
public override void InitialiseLevel() { base.InitialiseLevel(); //graphics = new GraphicsDeviceManager (this); //vxEngine.Game.Content.RootDirectory = "Content"; Accelerometer.Initialize(); ConvertUnits.SetDisplayUnitToSimUnitRatio(32); //Initialise Physics vxEngine World = new World(Vector2.UnitY * 20); #if WINDOWS_PHONE TargetElapsedTime = TimeSpan.FromTicks(333333); #endif }
private async void SetupSensors(bool serviceAsParameter) { pbar.Visibility = Windows.UI.Xaml.Visibility.Visible; ClearSensors(); btnSetup.IsEnabled = false; btnSetupParam.IsEnabled = false; spTestButtons.Visibility = Windows.UI.Xaml.Visibility.Collapsed; Exception ex = null; try { if (serviceAsParameter) { acc = new Accelerometer(); acc.SensorValueChanged += SensorValueChanged; await acc.Initialize((await GattUtils.GetDevicesOfService(acc.SensorServiceUuid))[0]); await acc.EnableSensor(); gyro = new Gyroscope(); gyro.SensorValueChanged += SensorValueChanged; await gyro.Initialize((await GattUtils.GetDevicesOfService(gyro.SensorServiceUuid))[0]); await gyro.EnableSensor(); hum = new HumiditySensor(); hum.SensorValueChanged += SensorValueChanged; await hum.Initialize((await GattUtils.GetDevicesOfService(hum.SensorServiceUuid))[0]); await hum.EnableSensor(); ks = new SimpleKeyService(); ks.SensorValueChanged += SensorValueChanged; await ks.Initialize((await GattUtils.GetDevicesOfService(ks.SensorServiceUuid))[0]); await ks.EnableSensor(); mg = new Magnetometer(); mg.SensorValueChanged += SensorValueChanged; await mg.Initialize((await GattUtils.GetDevicesOfService(mg.SensorServiceUuid))[0]); await mg.EnableSensor(); ps = new PressureSensor(); ps.SensorValueChanged += SensorValueChanged; await ps.Initialize((await GattUtils.GetDevicesOfService(ps.SensorServiceUuid))[0]); await ps.EnableSensor(); tempSen = new IRTemperatureSensor(); tempSen.SensorValueChanged += SensorValueChanged; await tempSen.Initialize((await GattUtils.GetDevicesOfService(tempSen.SensorServiceUuid))[0]); await tempSen.EnableSensor(); spTestButtons.Visibility = Windows.UI.Xaml.Visibility.Visible; } else { acc = new Accelerometer(); acc.SensorValueChanged += SensorValueChanged; await acc.Initialize(); await acc.EnableSensor(); gyro = new Gyroscope(); gyro.SensorValueChanged += SensorValueChanged; await gyro.Initialize(); await gyro.EnableSensor(); hum = new HumiditySensor(); hum.SensorValueChanged += SensorValueChanged; await hum.Initialize(); await hum.EnableSensor(); ks = new SimpleKeyService(); ks.SensorValueChanged += SensorValueChanged; await ks.Initialize(); await ks.EnableSensor(); mg = new Magnetometer(); mg.SensorValueChanged += SensorValueChanged; await mg.Initialize(); await mg.EnableSensor(); ps = new PressureSensor(); ps.SensorValueChanged += SensorValueChanged; await ps.Initialize(); await ps.EnableSensor(); tempSen = new IRTemperatureSensor(); tempSen.SensorValueChanged += SensorValueChanged; await tempSen.Initialize(); await tempSen.EnableSensor(); spTestButtons.Visibility = Windows.UI.Xaml.Visibility.Visible; } } catch (Exception exc) { ex = exc; } if (ex != null) { await new MessageDialog(ex.Message).ShowAsync(); } pbar.Visibility = Windows.UI.Xaml.Visibility.Collapsed; btnSetup.IsEnabled = true; btnSetupParam.IsEnabled = true; }