4#include "ui_SConsole.h"
5#include "qwt_dial_needle.h"
8#include "qpushbutton.h"
21 void SetSocket(
int _fd )
26 void SetMSPanelID(
long long id)
31 void SetShipConsoleID(
long long id)
38 QwtDialSimpleNeedle *needle =
new QwtDialSimpleNeedle(QwtDialSimpleNeedle::Arrow,
true, Qt::red, QColor(Qt::gray).light(130));
39 MainEngineRight->setRange(-1.0,1.,0.01);
40 MainEngineRight->setNeedle(needle);
41 MainEngineLeft->setRange(-1.0,1.,0.01);
42 MainEngineLeft->setNeedle(needle);
43 Rudder->setRange(-1.0,1.,0.01);
44 Rudder->setNeedle(needle);
51 Slider->setHandleSize( 30, 16 );
52 Slider->setRange(-1.0, 1.0, 1.0, 0);
54 KnobX->setRange(0.0,1.0,0.01);
55 KnobY->setRange(0.0,1.0,0.01);
56 KnobZ->setRange(0.0,1.0,0.01);
61 Button0->setCheckable(
true);
62 Button1->setCheckable(
true);
63 Button2->setCheckable(
true);
64 Button3->setCheckable(
true);
66 checkBox->setCheckable(
true);
76 void JoystickUpdated(
long long id,
joyData_t data);
80 std::map<long long,joyData_t>::iterator it;
81 UpdateInputState(this->winId());
84 for( it = Joysticks.begin(); it != Joysticks.end(); it++)
86 LPDIRECTINPUTDEVICE8 dev = it->second.dev;
87 send(sockfd,(
const char *) &it->second.data,
sizeof(
myStruct), 0);
88 emit JoystickUpdated(it->first,it->second);
93 void UpdateJoystickData(
long long id,
joyData_t data)
95 if(
id == ShipConsoleID){
96 MainEngineRight->setValue( data.data.rglSlider[0]/1000. );
97 MainEngineLeft->setValue(data.data.rotAxis[2]/1000.);
98 Rudder->setValue(data.data.rotAxis[0]/1000. );
108 KnobX->setValue( data.data.posAxis[0]/1000. );
109 KnobY->setValue( data.data.posAxis[1]/1000. );
110 KnobZ->setValue( data.data.posAxis[2]/1000. );
113 if(data.data.rgbButtons[0]/128 == 1)
114 Button0->setChecked(
true);
115 else Button0->setChecked(
false);
117 if(data.data.rgbButtons[1]/128 == 1)
118 Button1->setChecked(
true);
119 else Button1->setChecked(
false);
120 if(data.data.rgbButtons[2]/128 == 1)
121 Button2->setChecked(
true);
122 else Button2->setChecked(
false);
123 if(data.data.rgbButtons[3]/128 == 1)
124 Button3->setChecked(
true);
125 else Button3->setChecked(
false);
127 if(data.data.rgbButtons[17]/128 == 1)
128 checkBox->setChecked(
true);
129 else checkBox->setChecked(
false);
139 long long ShipConsoleID;
Definition: program2.h:14
Definition: Joystick.h:78