Including Microsoft.XNA.Framework.Input.Touch in a project?
Posted
by
steven_desu
on Game Development
See other posts from Game Development
or by steven_desu
Published on 2011-03-07T23:51:10Z
Indexed on
2011/03/08
0:19 UTC
Read the original article
Hit count: 243
So after running through tutorials by both Microsoft and www.xnadevelopment.com I feel very confident in my ability to get to work on my first game using the XNA Framework. I've manipulated sprites, added audio, changed game states, and even went a step further to apply the knowledge I had and figure out how to make animations and basic 2-dimensional physics (including impulses, force, acceleration, and speed calculations)
But then shortly into the project I hit a curious bump that I've been unable to figure out.
In wanting to implement menus, pause screens, and several different aspects of play (a "pre-level" prep screen, the level itself, and a screen after the level to review how well you did) I took a look at Microsoft's Game State Management sample. I understood the concept, although it was admittedly quite a lot to take in. Not wanting to recreate the entire concept by scratch (after all- what purpose would that serve?) I tried copying and pasting the sample code into my own ScreenManager
class (as well as InputState
and GameScreen
classes) to try and borrow their ingenuity. When I did this, however, my project stopped compiling. I was getting the following error:
The type or namespace name 'Touch' does not exist in the namespace 'Microsoft.Xna.Framework.Input' (are you missing an assembly reference?)
Having read through their sample code already, I realized that this namespace and every function and class within it could be safely ripped from the code without losing functionality. It's a namespace simply for integrating with touchscreen devices (presumably Windows Phone 7, but maybe also tablets).
But then I began to wonder- how come Microsoft's sample compiled but mine didn't? I copied their code exactly so there must be a setting somewhere that I need to change in Visual Studio in order to correct this. I tried creating a new project as a Windows Phone 7 game rather than a Windows game, however that only forced it to compile to a Windows Phone emulator and denied me the ability to change the resolution and other features which I clearly had the power to do in the sample code.
So my question is simple - how do I properly use the namespace Microsoft.XNA.Framework.Input.Touch?
© Game Development or respective owner