Learn WP7 XNA Game development (four Input)

Source: Internet
Author: User

For Windows Phone7, there are three ways to interact with users: gestures, keystrokes, touches, and signals from some sensors (such as gravitational sensors), for the last one, to learn about Windows Phone7 Development (14. Device) So the interactive way that XNA games can be used is the same. But there is a big difference between XNA and Windows Phone7. Its main functions are in Microsoft.Xna.Framework.Input and Microsoft.Xna.Framework.Input.TouchPanel.

A Key: To the button, in fact, the control is only the back button, the other two keys are not controlled.

public void Update ()
{
if (Gamepad.getstate (Playerindex.one). Buttons.back = = buttonstate.pressed)//This is a system-filled
{
...
}
}

Two Touch: The state is also very few, only move, press, release so several.

Touchcollection touchstate = Touchpanel.getstate ();
foreach (touchlocation location in touchstate)
{
Switch (location. State)
{
Case touchlocationstate.pressed:
Break
Case touchlocationstate.moved:
Break
Case touchlocationstate.released:
Break
}
}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.