private void Awake() { instance = this; currentSplitScreenMode = SplitScreenMode.SINGLE; }
public void UpdateView(Player player, Player player2) { if (player.NextScreen.X < player2.NextScreen.X) { _leftViewPort.Height = _graphics.PreferredBackBufferHeight; _rightViewPort.Height = _graphics.PreferredBackBufferHeight; _leftViewPort.Width = _graphics.PreferredBackBufferWidth / 2; _rightViewPort.Width = _graphics.PreferredBackBufferWidth / 2; _leftViewPort.X = 0; _rightViewPort.X = _graphics.PreferredBackBufferWidth / 2; _leftViewPort.Y = 0; _rightViewPort.Y = 0; _splitScreenMode = SplitScreenMode.HORIZONTAL; proj = Matrix.CreateOrthographic(_blockScreenSize.X / 2, _blockScreenSize.Y, 0, 1); } else if (player.NextScreen.X > player2.NextScreen.X) { _leftViewPort.Height = _graphics.PreferredBackBufferHeight; _rightViewPort.Height = _graphics.PreferredBackBufferHeight; _leftViewPort.Width = _graphics.PreferredBackBufferWidth / 2; _rightViewPort.Width = _graphics.PreferredBackBufferWidth / 2; _leftViewPort.X = _graphics.PreferredBackBufferWidth / 2; _rightViewPort.X = 0; _leftViewPort.Y = 0; _rightViewPort.Y = 0; _splitScreenMode = SplitScreenMode.HORIZONTAL; proj = Matrix.CreateOrthographic(_blockScreenSize.X / 2, _blockScreenSize.Y, 0, 1); } else if (player.NextScreen.Y < player2.NextScreen.Y) { _leftViewPort.Height = _graphics.PreferredBackBufferHeight / 2; _rightViewPort.Height = _graphics.PreferredBackBufferHeight / 2; _leftViewPort.Width = _graphics.PreferredBackBufferWidth; _rightViewPort.Width = _graphics.PreferredBackBufferWidth; _leftViewPort.X = 0; _rightViewPort.X = 0; _leftViewPort.Y = 0; _rightViewPort.Y = _graphics.PreferredBackBufferHeight / 2; _splitScreenMode = SplitScreenMode.VERTICAL; proj = Matrix.CreateOrthographic(_blockScreenSize.X, _blockScreenSize.Y / 2, 0, 1); } else if (player.NextScreen.Y > player2.NextScreen.Y) { _leftViewPort.Height = _graphics.PreferredBackBufferHeight / 2; _rightViewPort.Height = _graphics.PreferredBackBufferHeight / 2; _leftViewPort.Width = _graphics.PreferredBackBufferWidth; _rightViewPort.Width = _graphics.PreferredBackBufferWidth; _leftViewPort.X = 0; _rightViewPort.X = 0; _leftViewPort.X = 0; _rightViewPort.X = 0; _leftViewPort.Y = _graphics.PreferredBackBufferHeight / 2; _rightViewPort.Y = 0; _splitScreenMode = SplitScreenMode.VERTICAL; proj = Matrix.CreateOrthographic(_blockScreenSize.X, _blockScreenSize.Y / 2, 0, 1); } else { _splitScreenMode = SplitScreenMode.NONE; proj = Matrix.CreateOrthographic(_blockScreenSize.X, _blockScreenSize.Y, 0, 1); } }