Silverlight 5 - XNA : Mouse.SetPosition
-
Tuesday, October 09, 2012 10:23 AM
I am using xna with silverlight 5 to build a 3d application.
Microsoft.Xna.Framework.Input.Mouse.SetPosition(10,10) is throwing the following exception
"The method or operation is not implemented."Can someone confirm if the implementation is available for this method or am I missing something here...
All Replies
-
Wednesday, October 10, 2012 7:59 AMModerator
Hi, I tried to reproduce your scenario, but I can't find Microsoft.Xna.Framework.Input namespace under Microsoft.Xna.Framework. But when I create an new Windows Phone Silverlight and XNA Application or Xbox 360 Game (4.0), It works now.
So I search it on MSDN, Microsoft.Xna.Framework.Input namespace is not available for Silverlight, but you can use it in Xbox Game or Windows Phone.
http://xboxforums.create.msdn.com/forums/t/108568.aspx
http://www.c-sharpcorner.com/blogs/3536/xna-silverlight-together-in-wp7.aspx
Please feel free to let me know if you have any question.
Best Regards,
-
Wednesday, October 10, 2012 10:48 AM
Thanks Johnson, I am trying to create a third person shooter with Silverlight and XNA.. The cross hair movement will be smoother if the mouse position can be set to center always.. and that is why I was looking at Mouse.SetPosition, and I see this cannot be done,
Any other recommendations that you are aware of which provides the same functionality ??
-
Sunday, October 14, 2012 9:50 AMModerator
Hi,
Seems that you are building an game. I suggest you to install Microsoft XNA Game Studio and create a new project (Windows Game or Xbox 360 Game) which you can use XNA Framework and of course including Microsoft.Xna.Framework.Input.Mouse.SetPoint(,) method.
http://msdn.microsoft.com/en-us/library/bb203894(v=xnagamestudio.40).aspx
http://xbox.create.msdn.com/en-US/education/catalog/
Or you can create a MyCrosshair Class represents the Crosshair which has X_Axis and Y_Axis properties, when the application is loaded, you can initialize its X_Axis and Y_Axis based on the Silverlight plugin size. (this is my own opinion)
Best Regards,

