summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <florian.a.jung@web.de>2012-11-26 18:29:06 +0100
committerFlorian Jung <florian.a.jung@web.de>2012-11-26 18:29:06 +0100
commited1f87e456476d53b962b37e5e7fbc8f9fc60499 (patch)
tree36e8e0c197fd15dcf341b2fee13e1c12f0299ad3
parent45b9374c21022b3b905e11ede35a7cca4428c5ac (diff)
linux-variante gefixt
-rw-r--r--mariokart01.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/mariokart01.cpp b/mariokart01.cpp
index f3e0039..955bbe7 100644
--- a/mariokart01.cpp
+++ b/mariokart01.cpp
@@ -20,7 +20,8 @@
*/
-#define FREEBSD
+//#define FREEBSD
+#define LINUX
#include <vector>
#include <unistd.h>
@@ -293,6 +294,7 @@ class Joystick
{
public:
Joystick();
+ ~Joystick();
void steer(float dir, float dead_zone=0.0);
void throttle(float t);
void press_a(bool);
@@ -307,6 +309,9 @@ class Joystick
void send_data();
int fifo_fd;
#endif
+#ifdef LINUX
+ int fd;
+#endif
float throt;
int throttle_cnt;
@@ -360,6 +365,10 @@ void Joystick::reset()
send_data();
}
+Joystick::~Joystick()
+{
+ close(fifo_fd);
+}
#endif
#ifdef LINUX
Joystick::Joystick()