Hi all,
I want to input joystick to my code,which is very simple smile.gif.I searched the net but find out that people use DirectInput , etc... but i want a very simple application, for example like when you pull right, a variable in the code changes from 0 to 10,whne you pull left another variable changes from 2 to 8, etc... I use VC++ v6.0, no .NET,no C# please. here i send a sample code I wrote in which i wanna input joystick for some try. thank you everyone.
Code:#include <time.h> #include <iostream> using namespace std; void wait ( double seconds ) { clock_t endwait; endwait = clock () + seconds * CLK_TCK ; while (clock() < endwait) {} } int main() { double t; double delt; double delf; double function; cout<< "Derivative of the function : "<<endl; cin>>delf ; cout<< "Time deviation : "<<endl; cin>>delt; t=0.0; function=0.0; do { function = function+ delf*delt ; // here i want to add joystick reading here // joy1= ....??? //joy2= .....??? // like : when i move left,it reads 5 for joy1, and when i move right it reads 3 for joy2, etc... // moreover,it eould be superb if also i can read the value as how much i move joystick, //for example, when i move it from center to left end,joy1 value increases from 0 to 8. // PLEASE HELP // wait (delt); t=t+delt; cout<<" Function is "<<function<<endl; // modifed function with joystick input : //function= } while (t <= 40); return 0; }



LinkBack URL
About LinkBacks


