Index: trunk/src/gl/gl_device.cc
===================================================================
--- trunk/src/gl/gl_device.cc	(revision 172)
+++ trunk/src/gl/gl_device.cc	(revision 184)
@@ -25,5 +25,5 @@
 	m_info = NULL;
 
-	if ( SDL_Init( SDL_INIT_VIDEO ) < 0 )
+	if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) < 0 )
 	{
 		NV_LOG( LOG_CRITICAL, "Video initialization failed: " << SDL_GetError( ) );
Index: trunk/src/gl/gl_window.cc
===================================================================
--- trunk/src/gl/gl_window.cc	(revision 172)
+++ trunk/src/gl/gl_window.cc	(revision 184)
@@ -132,4 +132,41 @@
 }
 
+static bool sdl_joy_button_event_to_io_event( const SDL_JoyButtonEvent& jb, io_event& jevent )
+{
+	jevent.type            = EV_JOY_BUTTON;
+	jevent.jbutton.id      = jb.which;
+	jevent.jbutton.button  = jb.button;
+	jevent.jbutton.pressed = (jb.type == SDL_PRESSED);
+	return true;
+}
+
+static bool sdl_joy_axis_event_to_io_event( const SDL_JoyAxisEvent& ja, io_event& jevent )
+{
+	jevent.type          = EV_JOY_AXIS;
+	jevent.jaxis.id      = ja.which;
+	jevent.jaxis.axis    = ja.axis;
+	jevent.jaxis.value   = ja.value;
+	return true;
+}
+
+static bool sdl_joy_hat_event_to_io_event( const SDL_JoyHatEvent& jh, io_event& jevent )
+{
+	jevent.type          = EV_JOY_HAT;
+	jevent.jhat.id       = jh.which;
+	jevent.jhat.hat      = jh.hat;
+	jevent.jhat.value    = jh.value;
+	return true;
+}
+
+static bool sdl_joy_ball_event_to_io_event( const SDL_JoyBallEvent& jb, io_event& jevent )
+{
+	jevent.type          = EV_JOY_HAT;
+	jevent.jball.id      = jb.which;
+	jevent.jball.ball    = jb.ball;
+	jevent.jball.rx      = jb.xrel;
+	jevent.jball.ry      = jb.yrel;
+	return true;
+}
+
 static bool sdl_event_to_io_event( const SDL_Event& e, io_event& ioevent )
 {
@@ -156,9 +193,9 @@
 	case SDL_SYSWMEVENT      : ioevent.type = EV_SYSTEM; return true;
 	case SDL_QUIT            : ioevent.type = EV_QUIT;   return true;
-	case SDL_JOYAXISMOTION   : return false;
-	case SDL_JOYBALLMOTION   : return false;
-	case SDL_JOYHATMOTION    : return false;
-	case SDL_JOYBUTTONDOWN   : return false;
-	case SDL_JOYBUTTONUP     : return false;
+	case SDL_JOYAXISMOTION   : return sdl_joy_axis_event_to_io_event( e.jaxis, ioevent ); 
+	case SDL_JOYBALLMOTION   : return sdl_joy_ball_event_to_io_event( e.jball, ioevent ); 
+	case SDL_JOYHATMOTION    : return sdl_joy_hat_event_to_io_event( e.jhat, ioevent ); 
+	case SDL_JOYBUTTONDOWN   : return sdl_joy_button_event_to_io_event( e.jbutton, ioevent );
+	case SDL_JOYBUTTONUP     : return sdl_joy_button_event_to_io_event( e.jbutton, ioevent );
 	default : return false;
 	}
@@ -183,4 +220,15 @@
 	}
 
+// 	NV_LOG( LOG_INFO, "Joystick count : " << SDL_NumJoysticks() );
+// 	SDL_Joystick* j = SDL_JoystickOpen(0);
+// 	if (j)
+// 	{
+// 		NV_LOG( LOG_INFO, "Joystick Name: " << SDL_JoystickNameForIndex(0) );
+// 		NV_LOG( LOG_INFO, "Joystick Number of Axes: " << SDL_JoystickNumAxes(j));
+// 		NV_LOG( LOG_INFO, "Joystick Number of Buttons: " << SDL_JoystickNumButtons(j));
+// 		NV_LOG( LOG_INFO, "Joystick Number of Balls: " << SDL_JoystickNumBalls(j));
+// 	}
+
+
 	m_context = new gl_context( m_device, m_handle );
 	m_context->set_viewport( nv::ivec4( 0, 0, m_width, m_height ) );
