From 719b450343a9192d8baed2bae86d46743ca9200d Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Wed, 2 Jan 2013 17:45:08 -0600 Subject: [PATCH] Adding MouseAimVector to AGS Removing Camera extension --- axios/Axios_settings.cs | 1 + axios/Engine/AxiosGameScreen.cs | 10 ++++++++++ axios/Engine/Extensions/Camera.cs | 11 ----------- 3 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 axios/Engine/Extensions/Camera.cs diff --git a/axios/Axios_settings.cs b/axios/Axios_settings.cs index 6a456ce..689289e 100644 --- a/axios/Axios_settings.cs +++ b/axios/Axios_settings.cs @@ -117,6 +117,7 @@ * - Adding AddScreen method to ScreenManager to make the PlayerIndex optional (default of PlayerIndex.One) * - Adding visible flag to DrawableAxiosGameObject and SimpleDrawableAxiosGameObject * - Adding extension to mousestate (Position) to get a Vector2 object of the position + * - Added MouseAimVector to AGS - this allows you to get a vector to "shoot" with (realtive to the mouse and another object) a LinearVelocity in Farseer * */ #endregion diff --git a/axios/Engine/AxiosGameScreen.cs b/axios/Engine/AxiosGameScreen.cs index 0dce8cb..f289845 100644 --- a/axios/Engine/AxiosGameScreen.cs +++ b/axios/Engine/AxiosGameScreen.cs @@ -11,7 +11,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using GameStateManagement; +using Microsoft.Xna.Framework.Input; using Axios.Engine.Gleed2D; +using Axios.Engine.Extensions; namespace Axios.Engine { @@ -66,6 +68,14 @@ namespace Axios.Engine } + public Vector2 MouseAimVector(MouseState ms, Vector2 relativeposition) + { + Vector2 ret; + ret = this.Camera.ConvertScreenToWorld(ms.Position()) - relativeposition; + ret.Normalize(); + return ret; + } + /*public void AddGameObject(T gameobject) { if (gameobject is AxiosGameObject || gameobject is AxiosUIObject) diff --git a/axios/Engine/Extensions/Camera.cs b/axios/Engine/Extensions/Camera.cs deleted file mode 100644 index 1be06e0..0000000 --- a/axios/Engine/Extensions/Camera.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Axios.Engine.Extensions -{ - public static class Camera - { - } -}