summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()