Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Declaring Second Joystick (http://www.chiefdelphi.com/forums/showthread.php?t=102470)

DiedandLived 10-02-2012 15:29

Declaring Second Joystick
 
I have had issues attempting to make certain code only apply to the joystick in port 2, however it merely puts all the code into the first joystick. Any suggestions would be great!

DiedandLived 10-02-2012 15:57

Re: Declaring Second Joystick
 
Basically how do we declare a second joystick in C++.

mikets 10-02-2012 15:59

Re: Declaring Second Joystick
 
Code:

class MyRobot: public SimpleRobot
{
    Joystick stick1;
    Joystick stick2;
 
    MyRobot(): stick1(1),
              stick2(2)
    {
    }
    ...
    void OperatorControl()
    {
        if (stick1.GetRawButton(1))
        {
        }
        else if (stick2.GetRawButton(1))
        {
        }
    }
};


Supernovapsy 11-02-2012 18:25

Re: Declaring Second Joystick
 
Yeah, different numbers should be assigned to the joysticks.


All times are GMT -5. The time now is 17:37.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi