using
System;
using
System.Collections.Generic;
using
Microsoft.Xna.Framework;
using
Microsoft.Xna.Framework.GamerServices;
using
Microsoft.Xna.Framework.Graphics;
using
Microsoft.Xna.Framework.Input;
public
class GameClass
: Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
public GameClass()
{
graphics =
new
GraphicsDeviceManager(this);
}
protected override
void Update(GameTime
gameTime)
{
//**VIBRATION**VIBRATION**VIBRATION**VIBRATION**VIBRATION**VIBRATION**
//**VIBRATION**VIBRATION**VIBRATION**VIBRATION**VIBRATION**VIBRATION**
Vector2 leftThumb =
GamePad.GetState(PlayerIndex.One).ThumbSticks.Left;
Vector2 rightThumb =
GamePad.GetState(PlayerIndex.One).ThumbSticks.Right;
float leftMotor =
Math.Abs(leftThumb.X);
// 0->1.0
float rightMotor =
Math.Abs(rightThumb.X);
// 0->1.0
// Move the left and right thumbstick to
modify the left and right motor speeds
GamePad.SetVibration(PlayerIndex.One,
leftMotor, rightMotor);
//**VIBRATION**VIBRATION**VIBRATION**VIBRATION**VIBRATION**VIBRATION**
//**VIBRATION**VIBRATION**VIBRATION**VIBRATION**VIBRATION**VIBRATION**
base.Update(gameTime);
}
protected override
void Draw(GameTime
gameTime)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
base.Draw(gameTime);
}
}//End
GameClass Class
//
Program Entry Point
static
class Program
{
static void
Main(string[] args)
{
using (GameClass
game = new
GameClass())
{
game.Run();
}
}
} |