
#ifndef __WFX_SDL_SDLINPUTHANDLER_H__
#define __WFX_SDL_SDLINPUTHANDLER_H__

#include <WFX/WFXIncludes.h>

#include <WFX/input/InputHandler.h>

#include <SDL/SDL.h>

namespace WFX {

    namespace SDL {

        /**
         * SDL implementation of the Inputhandler interface
         */
        class SDLInputHandler : public WFX::input::InputHandler {
            public:
                /** maps SDL Keys to WFX Keys */
                static std::map<SDLKey, WFX::input::WFXKey> KeyMap;

                /**
                 * Ctor
                 * starts the SDL input subsystem
                 *
                 * @throws: WFXException if unable to init joystick subsystem
                 */
                SDLInputHandler();
                ~SDLInputHandler();

                /** implement Task interface */
                bool start();
                void update();
                void stop();

                /** inits KeyMap */
                static void WFXInit();

                void flushEvents();
                void getMousePos(Int* x, Int* y);
                
            protected:

            private:
                /** instance counter */
                static Int Instances;
                /** event structure */
                SDL_Event Event;
                /** joystick structures */
                SDL_Joystick** Joysticks;

                /** determines which key */
                WFX::input::WFXKey getKey();
                /** determines which Character */
                Char getChar();
                 

        };


    }

}


#endif //include guard


