updated project removed joystick code from windows

This commit is contained in:
Jared Bruni
2020-02-21 20:16:57 -08:00
parent f07c061776
commit dbfb7a1afe
3 changed files with 19 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
#include"controller.h" #include"controller.h"
#include<iostream> #include<iostream>
#ifndef _WIN32
bool Controller::open(int index) { bool Controller::open(int index) {
stick = SDL_JoystickOpen(index); stick = SDL_JoystickOpen(index);
@@ -38,3 +39,6 @@ int Controller::axis(int index) {
return SDL_JoystickGetAxis(stick, index); return SDL_JoystickGetAxis(stick, index);
return 0; return 0;
} }
#endif

View File

@@ -2,6 +2,8 @@
#ifndef __CONTROLLER_H__ #ifndef __CONTROLLER_H__
#define __CONTROLLER_H__ #define __CONTROLLER_H__
#ifndef _WIN32
#include "SDL.h" #include "SDL.h"
class Controller { class Controller {
@@ -25,3 +27,6 @@ private:
#endif #endif
#endif

View File

@@ -173,6 +173,7 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
} }
} }
*/ */
#ifndef _WIN32
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()));
@@ -185,6 +186,8 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
stream << "No controller detected...\n"; stream << "No controller detected...\n";
} }
Log(out_text); Log(out_text);
#endif
} }
@@ -1059,6 +1062,7 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
if(rt_val == false) return false; if(rt_val == false) return false;
playback->Play(); playback->Play();
QString out_text; QString out_text;
#ifndef _WIN32
QTextStream stream(&out_text); QTextStream stream(&out_text);
if(controller.open(0)) { if(controller.open(0)) {
stream << "Controller: " << controller.getControllerName() << " connected...\n"; stream << "Controller: " << controller.getControllerName() << " connected...\n";
@@ -1067,6 +1071,7 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
stream << "No controller detected...\n"; stream << "No controller detected...\n";
} }
Log(out_text); Log(out_text);
#endif
return true; return true;
} }
@@ -1165,6 +1170,7 @@ bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, b
playback->setVideo(capture_video,writer,recording); playback->setVideo(capture_video,writer,recording);
playback->Play(); playback->Play();
disp->show(); disp->show();
#ifndef _WIN32
QString out_text; QString out_text;
QTextStream streamx(&out_text); QTextStream streamx(&out_text);
if(controller.open(0)) { if(controller.open(0)) {
@@ -1174,6 +1180,8 @@ bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, b
streamx << "No controller detected...\n"; streamx << "No controller detected...\n";
} }
Log(out_text); Log(out_text);
#endif
return true; return true;
} }
@@ -1827,6 +1835,7 @@ void AC_MainWindow::showGLDisplay() {
} }
void AC_MainWindow::chk_Joystick() { void AC_MainWindow::chk_Joystick() {
#ifndef _WIN32
SDL_Event e; SDL_Event e;
while(SDL_PollEvent(&e)) { while(SDL_PollEvent(&e)) {
static int speed = 0; static int speed = 0;
@@ -1919,4 +1928,5 @@ void AC_MainWindow::chk_Joystick() {
} }
} }
#endif
} }