| using Axios.Engine.Extenions;␍␊ |
| using Axios.Engine.UI;␍␊ |
| using Axios;␍␊ |
| using System;␍␊ |
| using GameStateManagement;␍␊ |
| using Microsoft.Xna.Framework.Input;␍␊ |
| ␍␊ |
| namespace axios_tennis␍␊ |
| {␍␊ |
|
| this.HasVirtualStick = true;␍␊ |
| this.HasCursor = true;␍␊ |
| EnableCameraControl = false;␍␊ |
| TransitionOnTime = TimeSpan.FromSeconds(1.5);␍␊ |
| TransitionOffTime = TimeSpan.FromSeconds(0.5);␍␊ |
| }␍␊ |
| ␍␊ |
| public override void LoadContent()␍␊ |
| public override void Activate(bool instancePreserved)␍␊ |
| {␍␊ |
| base.LoadContent();␍␊ |
| ␉ base.Activate(instancePreserved);␍␊ |
| int xcount, ycount;␍␊ |
| Texture2D _blocks = ScreenManager.Content.Load<Texture2D>("blocks");␍␊ |
| Texture2D _blocks = ScreenManager.Game.Content.Load<Texture2D>("blocks");␍␊ |
| Texture2D[,] _blocktextures = _blocks.Split(32, 32, 8, 8, out xcount, out ycount);␍␊ |
| ␍␊ |
| #if WINDOWS_PHONE␍␊ |
|
| _pwall = new Wall(new Vector2(-ConvertUnits.ToSimUnits(ScreenManager.GraphicsDevice.Viewport.Width) / 2f, 0), "pwall");␍␊ |
| _ewall = new Wall(new Vector2(ConvertUnits.ToSimUnits(ScreenManager.GraphicsDevice.Viewport.Width) / 2f, 0), "ewall");␍␊ |
| ␍␊ |
| _sf = ScreenManager.Content.Load<SpriteFont>("scorefont");␍␊ |
| _sf = ScreenManager.Game.Content.Load<SpriteFont>("scorefont");␍␊ |
| ␍␊ |
| _ppaddle.AllowAutomaticMouseJoint = true;␍␊ |
| AddGameObject(_ewall);␍␊ |
|
| AddGameObject(_ball);␍␊ |
| }␍␊ |
| ␍␊ |
| void b_MouseDown(object sender, AxiosGameScreen gameScreen, InputHelper input)␍␊ |
| /*void b_MouseDown(object sender, AxiosGameScreen gameScreen, InputState input)␍␊ |
| {␍␊ |
| if (HasVirtualStick)␍␊ |
| HasVirtualStick = false;␍␊ |
| else␍␊ |
| HasVirtualStick = true;␍␊ |
| }␍␊ |
| }*/␍␊ |
| ␍␊ |
| public override void HandleInput(InputHelper input, GameTime gameTime)␍␊ |
| public override void HandleInput(GameTime gameTime, InputState input)␍␊ |
| {␍␊ |
| base.HandleInput(input, gameTime);␍␊ |
| base.HandleInput(gameTime, input);␍␊ |
| ␍␊ |
| ␍␊ |
| //This must be handled in the screen because there are multiple paddles␍␊ |
| ␍␊ |
| if (_ppaddle != null)␍␊ |
| {␍␊ |
| if (input.VirtualState.ThumbSticks.Left.Y > 0 || input.GamePadState.ThumbSticks.Left.Y > 0)␍␊ |
| if (input.VirtualState.ThumbSticks.Left.Y > 0 ||␍␊ |
| input.CurrentGamePadStates[0].ThumbSticks.Left.Y > 0 ||␍␊ |
| input.CurrentKeyboardStates[0].IsKeyDown(Keys.Down)␍␊ |
| )␍␊ |
| {␍␊ |
| _ppaddle.PaddleJoint.MotorSpeed = -40f;␍␊ |
| }␍␊ |
| else if (input.VirtualState.ThumbSticks.Left.Y < 0 || input.GamePadState.ThumbSticks.Left.Y < 0)␍␊ |
| else if (input.VirtualState.ThumbSticks.Left.Y < 0 ||␍␊ |
| input.CurrentGamePadStates[0].ThumbSticks.Left.Y < 0 ||␍␊ |
| input.CurrentKeyboardStates[0].IsKeyDown(Keys.Up)␍␊ |
| )␍␊ |
| {␍␊ |
| _ppaddle.PaddleJoint.MotorSpeed = 40f;␍␊ |
| }␍␊ |