Adding MouseAimVector to AGS

Removing Camera extension
This commit is contained in:
Nathan Adams 2013-01-02 17:45:08 -06:00
parent 1b5f1bfaf9
commit 719b450343
3 changed files with 11 additions and 11 deletions

View File

@ -117,6 +117,7 @@
* - Adding AddScreen method to ScreenManager to make the PlayerIndex optional (default of PlayerIndex.One) * - Adding AddScreen method to ScreenManager to make the PlayerIndex optional (default of PlayerIndex.One)
* - Adding visible flag to DrawableAxiosGameObject and SimpleDrawableAxiosGameObject * - Adding visible flag to DrawableAxiosGameObject and SimpleDrawableAxiosGameObject
* - Adding extension to mousestate (Position) to get a Vector2 object of the position * - 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 #endregion

View File

@ -11,7 +11,9 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using GameStateManagement; using GameStateManagement;
using Microsoft.Xna.Framework.Input;
using Axios.Engine.Gleed2D; using Axios.Engine.Gleed2D;
using Axios.Engine.Extensions;
namespace Axios.Engine 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>(T gameobject) /*public void AddGameObject<T>(T gameobject)
{ {
if (gameobject is AxiosGameObject || gameobject is AxiosUIObject) if (gameobject is AxiosGameObject || gameobject is AxiosUIObject)

View File

@ -1,11 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Axios.Engine.Extensions
{
public static class Camera
{
}
}