diff -r 007bf2a6fc8bd2ebebe092777a914b52448b57df -r 295db41d979091b4db0fbd6105520b657763e833 axios/Engine/SimpleAxiosGameObject.cs --- a/axios/Engine/SimpleAxiosGameObject.cs Mon Mar 19 20:33:25 2012 -0500 +++ b/axios/Engine/SimpleAxiosGameObject.cs Tue Mar 20 21:44:43 2012 -0500 @@ -18,6 +18,13 @@ public bool ApplyConstantVelocity = false; public Vector2 ConstantVelocity; + private bool _allowmousejoint = false; + public bool AllowAutomaticMouseJoint + { + get { return _allowmousejoint; } + set { _allowmousejoint = value; } + } + public SimpleAxiosGameObject() { AxiosLog.Instance.AddLine("[Axios Engine] - Creating SimpleAxiosGameObject " + Name, LoggingFlag.DEBUG); diff -r 007bf2a6fc8bd2ebebe092777a914b52448b57df -r 295db41d979091b4db0fbd6105520b657763e833 axios/ScreenSystem/PhysicsGameScreen.cs --- a/axios/ScreenSystem/PhysicsGameScreen.cs Mon Mar 19 20:33:25 2012 -0500 +++ b/axios/ScreenSystem/PhysicsGameScreen.cs Tue Mar 20 21:44:43 2012 -0500 @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Input; +using Axios.Engine; namespace FarseerPhysics.SamplesFramework { @@ -17,17 +18,20 @@ private float _agentForce; private float _agentTorque; -#if DEBUG private FixedMouseJoint _fixedMouseJoint; -#endif private Body _userAgent; protected PhysicsGameScreen() { TransitionOnTime = TimeSpan.FromSeconds(0.75); TransitionOffTime = TimeSpan.FromSeconds(0.75); +#if DEBUG + EnableCameraControl = true; HasCursor = true; - EnableCameraControl = true; +#else + EnableCameraControl = false; + HasCursor = false; +#endif _userAgent = null; World = null; Camera = null; @@ -157,21 +161,7 @@ EnableOrDisableFlag(DebugViewFlags.AABB); } - if (input.IsNewButtonPress(Buttons.Back) || input.IsNewKeyPress(Keys.Escape)) - { - if (this.ScreenState == SamplesFramework.ScreenState.Active && this.TransitionPosition == 0 && this.TransitionAlpha == 1) - { //Give the screens a chance to transition - - CleanUp(); - ExitScreen(); - - } - } - - if (HasCursor) - { - HandleCursor(input); - } +#endif if (_userAgent != null) { @@ -182,14 +172,28 @@ { HandleCamera(input, gameTime); } -#endif + + if (HasCursor) + { + HandleCursor(input); + } + + if (input.IsNewButtonPress(Buttons.Back) || input.IsNewKeyPress(Keys.Escape)) + { + if (this.ScreenState == SamplesFramework.ScreenState.Active && this.TransitionPosition == 0 && this.TransitionAlpha == 1) + { //Give the screens a chance to transition + + CleanUp(); + ExitScreen(); + + } + } base.HandleInput(input, gameTime); } public virtual void HandleCursor(InputHelper input) { - #if DEBUG Vector2 position = Camera.ConvertScreenToWorld(input.Cursor); if ((input.IsNewButtonPress(Buttons.A) || @@ -197,7 +201,7 @@ _fixedMouseJoint == null) { Fixture savedFixture = World.TestPoint(position); - if (savedFixture != null) + if (savedFixture != null && savedFixture.UserData is SimpleAxiosGameObject && ((SimpleAxiosGameObject)(savedFixture.UserData)).AllowAutomaticMouseJoint) { Body body = savedFixture.Body; _fixedMouseJoint = new FixedMouseJoint(body, position); @@ -219,14 +223,14 @@ { _fixedMouseJoint.WorldAnchorB = position; } - #endif + } private void HandleCamera(InputHelper input, GameTime gameTime) { Vector2 camMove = Vector2.Zero; -#if DEBUG + if (input.KeyboardState.IsKeyDown(Keys.Up)) { camMove.Y -= 10f * (float)gameTime.ElapsedGameTime.TotalSeconds; @@ -259,12 +263,12 @@ { Camera.ResetCamera(); } -#endif + } private void HandleUserAgent(InputHelper input) { -#if DEBUG + Vector2 force = _agentForce * new Vector2(input.GamePadState.ThumbSticks.Right.X, -input.GamePadState.ThumbSticks.Right.Y); float torque = _agentTorque * (input.GamePadState.Triggers.Right - input.GamePadState.Triggers.Left); @@ -304,7 +308,7 @@ _userAgent.ApplyForce(force); _userAgent.ApplyTorque(torque); -#endif + } private void EnableOrDisableFlag(DebugViewFlags flag)