mirror of
https://github.com/lostjared/Acid.Cam.v2.Qt.git
synced 2025-12-14 19:00:01 +01:00
added movement speed change with controller
This commit is contained in:
@@ -176,6 +176,12 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
|
|||||||
Controller::init();
|
Controller::init();
|
||||||
joy_timer = new QTimer(this);
|
joy_timer = new QTimer(this);
|
||||||
connect(joy_timer, SIGNAL(timeout()), this, SLOT(chk_Joystick()));
|
connect(joy_timer, SIGNAL(timeout()), this, SLOT(chk_Joystick()));
|
||||||
|
if(controller.open(0)) {
|
||||||
|
std::cout << "Controller connected...\n";
|
||||||
|
joy_timer->start();
|
||||||
|
} else {
|
||||||
|
std::cout << "No controller detected...\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1823,6 +1829,49 @@ void AC_MainWindow::chk_Joystick() {
|
|||||||
if(controller.button(0)) {
|
if(controller.button(0)) {
|
||||||
next_filter();
|
next_filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int movement_index = 0;
|
||||||
|
|
||||||
|
if(controller.button(7)) {
|
||||||
|
if(movement_index < 2)
|
||||||
|
movement_index++;
|
||||||
|
|
||||||
|
switch(movement_index) {
|
||||||
|
case 0:
|
||||||
|
movementOption1();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
movementOption2();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
movementOption3();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(controller.button(6)) {
|
||||||
|
if(movement_index > 0)
|
||||||
|
--movement_index;
|
||||||
|
|
||||||
|
switch(movement_index) {
|
||||||
|
case 0:
|
||||||
|
movementOption1();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
movementOption2();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
movementOption3();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
for(int i = 0; i < 8; ++i) {
|
||||||
|
if(controller.button(i)) {
|
||||||
|
std::cout << "button: " << i << "\n";
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
auto change = [](AC_MainWindow *window, int index) {
|
auto change = [](AC_MainWindow *window, int index) {
|
||||||
switch(index) {
|
switch(index) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -1848,6 +1897,7 @@ void AC_MainWindow::chk_Joystick() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if(controller.button(3)) {
|
if(controller.button(3)) {
|
||||||
if(speed < 6) {
|
if(speed < 6) {
|
||||||
++speed;
|
++speed;
|
||||||
@@ -1860,5 +1910,6 @@ void AC_MainWindow::chk_Joystick() {
|
|||||||
change(this, speed);
|
change(this, speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user