Original Post
recently i designed a wrapper for direct input + actionmapping (for a gameengine ofc) downloadlink i wanted some ideas of you what to improve ... i dont have any problems, but maybe i dont see something coming, or you have simply better ideas, suggestions ... just have a look ;) please interface( i removed doxycomments for spacepurposes ;) ):
class GLInput {
public:
GLInput( HWND hwnd );
~GLInput();
bool isInitialized() const;
void poll();
const unsigned char *getKeys() const;
int getMouseX() const;
int getMouseY() const;
int getMouseWheel() const;
};
class GLActionMap {
public:
GLActionMap( GLInput *glinput );
~GLActionMap();
void addAction( unsigned int action, const std::vector<unsigned char>& keyv );
void addAction( unsigned int action, unsigned char key );
void delAction( unsigned int action );
const std::vector<unsigned char>& getKeysFromAction( unsigned int action ) const;
unsigned int getActionFromKeys( const std::vector<unsigned char>& keyv ) const;
unsigned int getActionFromKeys( unsigned char key ) const;
unsigned int checkCollision( const std::vector<unsigned char>& keyv ) const;
unsigned int checkCollision( unsigned char key ) const;
void poll();
void clear();
void clearStates();
void save( char **buffer, unsigned int *bufferlen ) const;
void load( const char *buffer, unsigned int bufferlen );
virtual void actionStart( unsigned int action );
virtual void actionEnd( unsigned int action );
virtual void mouseMove( int x, int y, int wheel );
};
struct ActionInfo {
ActionInfo( bool _active= false, const std::vector<unsigned char>& _keyv= std::vector<unsigned char>() )
: active( _active ), keyv( _keyv ) {}
bool active;
std::vector<unsigned char> keyv;
};