/*****************************************************************************
 * $LastChangedDate: 2009-12-15 00:38:08 -0500 (Tue, 15 Dec 2009) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Joystick device class (SDL).
 *//*
 * LEGAL:   COPYRIGHT (C) 2009 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#if COMPILE_SDL
#ifndef INPUT_DEVICE_JOYSTICK_SDL_HH
#define INPUT_DEVICE_JOYSTICK_SDL_HH 1

#include "input/device_joystick.hh"

#include <SDL.h>
// SDL header defines a main() macro, undefine it.
#undef main

namespace input {

////////////////////////////////////////////////////////////////////////////////
/// @brief Joystick device class (SDL).
///
/// This is a private implementation of JoystickDevice.
///
class JoystickDeviceSDL : public JoystickDevice
{
PREVENT_COPYING(JoystickDeviceSDL)
friend class JoystickDevice;
private:
                    JoystickDeviceSDL( void );
    virtual         ~JoystickDeviceSDL();

// Abstract methods to implement:
    virtual bool    EnableDevice( void ) { return Open(); }
    virtual bool    PollJoystickDevice( JoystickEvent& event /*OUT*/ );
    virtual void    PrintStatus( void );

// Specific:
    bool            Open( void );
    void            Close( void );

private:
    int                     mJoystickNum;
    SafePtr<SDL_Joystick>   mJoystickSDL;       ///< SDL joystick object
};

} // namespace input

#endif // INPUT_DEVICE_JOYSTICK_SDL_HH
#endif // COMPILE_SDL
