Anyway this is the code

Code: Select all

`#include "CXBOXController.h"`

#include <iostream>

#include <stdio.h>

#include <cmath>

using namespace std;

CXBOXController* Player1;

int main()

{

char one[500];

char two[500];

char three[500];

int i = 0;

double x1 ;

double x2 ;

double x3 ;

double y1 ;

double y2 ;

double y3 ;

double z1 ;

double z2 ;

double z3 ;

double t1;

double t2;

double t3;

double a;

double ax;

double ay;

double az;

double number;

int v1 = 0;

int v2 = 0;

Player1 = new CXBOXController(1);

do

{

fgets(one, 500, stdin);

sscanf (one,"%*c %*c %*c %LG %*c %*c %*c %LG %*c %*c %*c %LG %*c %*c %*c %LG ", &t1, &x1, &y1, &z1);

fgets(two, 500, stdin);

sscanf (two,"%*c %*c %*c %LG %*c %*c %*c %LG %*c %*c %*c %LG %*c %*c %*c %LG ", &t2, &x2, &y2, &z2);

fgets(three, 500, stdin);

sscanf (three,"%*c %*c %*c %LG %*c %*c %*c %LG %*c %*c %*c %LG %*c %*c %*c %LG ", &t3, &x3, &y3, &z3);

ax = (((x2-x3)/(t3-t2))-((x1-x2)/(t2-t1)))/(t3-t1)*10;

ay = (((y2-y3)/(t3-t2))-((y1-y2)/(t2-t1)))/(t3-t1)*10;

az = (((z2-z3)/(t3-t2))-((z1-z2)/(t2-t1)))/(t3-t1)*10;

number=pow(ax,2)+pow(ay,2)+pow(az,2);

a= sqrt(number);

if(ax<0)

{ v1=a*20;

}

else

{ v2=a*20;

}

Player1->Vibrate(v1,v2);

;

}

while (i==0) ;

cin.get();

return( 0 );

}

The controller class was shamelessly copied from this tutorial: http://www.codeproject.com/KB/directx/x ... input.aspx

Feedback is what I'm after really (excuse the pun ) as I know this is probably terrible coding, and is it worth continuing? I'm not going to post the executable until somebody has verified that it won't crash somebody's system.