#include "Input.h" #include "Renderer.h" namespace I { /* ======================================================================================================================================= data vars = ======================================================================================================================================= */ short keys [SDLK_LAST]; // shows the current key state. 0: unpressed, 1: pressed once, n is >1: kept pressed 'n' times continucely short mouseBtns [8]; // mouse btns. Supporting 3 btns & wheel. Works the same as above Vec2 mousePosNdc; // the coords are in the ndc space Vec2 mousePos; // the coords are in the window space Vec2 mouseVelocity; bool warpMouse = false; bool hideCursor = true; /* ======================================================================================================================================= reset = ======================================================================================================================================= */ void Reset( void ) { memset( keys, 0, sizeof(keys) ); memset(mouseBtns, 0, sizeof(mouseBtns) ); mousePosNdc.setZero(); mouseVelocity.setZero(); } /* ======================================================================================================================================= handleEvents = ======================================================================================================================================= */ void handleEvents() { if( hideCursor ) SDL_ShowCursor( SDL_DISABLE ); else SDL_ShowCursor( SDL_ENABLE ); // add the times a key is bying pressed for( int x=0; x