diff --git a/Engine b/Engine index 9f4ad88..d2881e9 160000 --- a/Engine +++ b/Engine @@ -1 +1 @@ -Subproject commit 9f4ad882e3db456d68dbc85b1e37c2a4e8bf150f +Subproject commit d2881e94df2796174795e5ef04b057ac6580bda3 diff --git a/Game/Game1.cs b/Game/Game1.cs index f715f03..fea46b9 100644 --- a/Game/Game1.cs +++ b/Game/Game1.cs @@ -42,32 +42,32 @@ public class Game1 : Game IGameObject gameObjectCamera = gameManager.InstantiateGameObject(); gameObjectCamera.Name = "Camera"; - gameObjectCamera.Transform.Position = new Vector2(Window.ClientBounds.Width * .5f, Window.ClientBounds.Height * .5f); + gameObjectCamera.Transform.Position = Vector2.Zero; gameManager.Camera = gameObjectCamera.BehaviourController.AddBehaviour(); gameManager.Camera.Viewport = GraphicsDevice.Viewport; IGameObject gameObjectBall = gameManager.InstantiateGameObject(); gameObjectBall.Name = "Ball"; - gameObjectBall.Transform.Position = new Vector2(Window.ClientBounds.Width * .5f, Window.ClientBounds.Height * .5f); - gameObjectBall.Transform.Scale = new Vector2(.025f, .025f); - gameObjectBall.BehaviourController.AddBehaviour(new Vector2(.1f, .1f), 100f); + gameObjectBall.Transform.Position = Vector2.Zero; + gameObjectBall.Transform.Scale = new Vector2(1f / 51.2f, 1f / 51.2f); + // gameObjectBall.BehaviourController.AddBehaviour(new Vector2(.1f, .1f), 100f); gameObjectBall.BehaviourController.AddBehaviour().Assign(spriteBall); IGameObject gameObjectLeft = gameManager.InstantiateGameObject(); gameObjectLeft.Name = "Left"; - gameObjectLeft.Transform.Position = new Vector2(Window.ClientBounds.Width * .1f, Window.ClientBounds.Height * .5f); - gameObjectLeft.Transform.Scale = new Vector2(Window.ClientBounds.Width * .02f, Window.ClientBounds.Height * .15f); + gameObjectLeft.Transform.Position = new Vector2(-350f, 0f); + gameObjectLeft.Transform.Scale = new Vector2(10f, 40f); gameObjectLeft.BehaviourController.AddBehaviour(); - gameObjectLeft.BehaviourController.AddBehaviour(Keys.W, Keys.S, 200f); + gameObjectLeft.BehaviourController.AddBehaviour(Keys.W, Keys.S, 400f); gameObjectLeft.BehaviourController.AddBehaviour().Assign(spriteBox); IGameObject gameObjectRight = gameManager.InstantiateGameObject(); gameObjectRight.Name = "Right"; - gameObjectRight.Transform.Position = new Vector2(Window.ClientBounds.Width * .9f, Window.ClientBounds.Height * .5f); - gameObjectRight.Transform.Scale = new Vector2(Window.ClientBounds.Width * .02f, Window.ClientBounds.Height * .15f); + gameObjectRight.Transform.Position = new Vector2(350f, 0f); + gameObjectRight.Transform.Scale = new Vector2(10f, 40f); gameObjectRight.BehaviourController.AddBehaviour(); - gameObjectRight.BehaviourController.AddBehaviour(Keys.Up, Keys.Down, 200f); + gameObjectRight.BehaviourController.AddBehaviour(Keys.Up, Keys.Down, 400f); gameObjectRight.BehaviourController.AddBehaviour().Assign(spriteBox); // TODO: use this.Content to load your game content here } @@ -79,17 +79,25 @@ public class Game1 : Game if (Keyboard.GetState().IsKeyDown(Keys.F)) { + if (_graphics.IsFullScreen) + return; + _graphics.PreferMultiSampling = false; _graphics.PreferredBackBufferWidth = GraphicsDevice.Adapter.CurrentDisplayMode.Width; _graphics.PreferredBackBufferHeight = GraphicsDevice.Adapter.CurrentDisplayMode.Height; _graphics.IsFullScreen = true; _graphics.ApplyChanges(); + + float previousScreenSize = MathF.Sqrt(MathF.Pow(gameManager.Camera.Viewport.Width, 2f) + MathF.Pow(gameManager.Camera.Viewport.Height, 2f)); + float currentScreenSize = MathF.Sqrt(MathF.Pow(GraphicsDevice.Viewport.Width, 2f) + MathF.Pow(GraphicsDevice.Viewport.Height, 2f)); + gameManager.Camera.Zoom /= previousScreenSize / currentScreenSize; gameManager.Camera.Viewport = GraphicsDevice.Viewport; } + if (Keyboard.GetState().IsKeyDown(Keys.U)) - { - gameManager.Camera.Zoom += gameTime.ElapsedGameTime.Nanoseconds * 0.000025f; - } + gameManager.Camera.Zoom += gameTime.ElapsedGameTime.Nanoseconds * 0.00025f; + if (Keyboard.GetState().IsKeyDown(Keys.J)) + gameManager.Camera.Zoom -= gameTime.ElapsedGameTime.Nanoseconds * 0.00025f; if (Keyboard.GetState().IsKeyDown(Keys.Q)) gameManager.Camera.Rotation += gameTime.ElapsedGameTime.Nanoseconds * 0.000025f;