protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set the android global context if (PlatformAndroid.Context == null) { PlatformAndroid.Context = this; } // Remove the title bar RequestWindowFeature(WindowFeatures.NoTitle); // Unpack the files contained in the apk //await VirtualFileSystem.UnpackAPK(); // Create the Android OpenGl view GameView = new AndroidStrideGameView(this); // setup the application view and stride game context SetupGameViewAndGameContext(); // set up a listener to the android ringer mode (Normal/Silent/Vibrate) ringerModeIntentReceiver = new RingerModeIntentReceiver((AudioManager)GetSystemService(AudioService)); RegisterReceiver(ringerModeIntentReceiver, new IntentFilter(AudioManager.RingerModeChangedAction)); SetFullscreenView(); InitializeFullscreenViewCallback(); }
public KeyboardAndroid(InputSourceAndroid source, AndroidStrideGameView gameView) { Source = source; this.gameView = gameView; var listener = new Listener(this); gameView.SetOnKeyListener(listener); }
public PointerAndroid(InputSourceAndroid source, AndroidStrideGameView uiControl) { Source = source; this.uiControl = uiControl; var listener = new Listener(this); uiControl.Resize += OnResize; uiControl.SetOnTouchListener(listener); OnResize(this, null); }
public override void Initialize(InputManager inputManager) { var context = inputManager.Game.Context as GameContextAndroid; uiControl = context.Control; // Create android pointer and keyboard keyboard = new KeyboardAndroid(this, uiControl); pointer = new PointerAndroid(this, uiControl); RegisterDevice(keyboard); RegisterDevice(pointer); // Create android sensors if ((accelerometerListener = TryGetSensorListener(SensorType.Accelerometer)) != null) { accelerometerSensor = new AccelerometerSensor(this, "Android"); RegisterDevice(accelerometerSensor); } if ((linearAccelerationListener = TryGetSensorListener(SensorType.LinearAcceleration)) != null) { userAccelerationSensor = new UserAccelerationSensor(this, "Android"); RegisterDevice(userAccelerationSensor); } if ((gyroscopeListener = TryGetSensorListener(SensorType.Gyroscope)) != null) { gyroscopeSensor = new GyroscopeSensor(this, "Android"); RegisterDevice(gyroscopeSensor); } if ((gravityListener = TryGetSensorListener(SensorType.Gravity)) != null) { gravitySensor = new GravitySensor(this, "Android"); RegisterDevice(gravitySensor); } if ((orientationListener = TryGetSensorListener(SensorType.RotationVector)) != null) { orientationSensor = new OrientationSensor(this, "Android"); compassSensor = new CompassSensor(this, "Android"); RegisterDevice(orientationSensor); RegisterDevice(compassSensor); } }
public InputSourceAndroid(AndroidStrideGameView uiControl) { this.uiControl = uiControl ?? throw new ArgumentNullException(nameof(uiControl)); }