directory cleaning
[physics.git] / src / input / inputManager.cpp
index a8491b1..3ecb477 100644 (file)
@@ -72,20 +72,41 @@ void input::update()
     }
 }
 
-bool input::isPressed(Uint8 key)
+Vector2 input::mousePosition()
+{
+    int x,y;
+    SDL_GetMouseState(&x, &y);
+
+    return Vector2(x,y);
+}
+
+bool input::mouseLeft()
+{
+    Uint8 state = SDL_GetMouseState(NULL, NULL);
+
+    return state & SDL_BUTTON(1);
+}
+bool input::mouseRight()
+{
+    Uint8 state = SDL_GetMouseState(NULL, NULL);
+
+    return state & SDL_BUTTON(3);
+}
+
+bool input::isPressed(SDLKey key)
 {
     return keyState[key] == isP || keyState[key] == wasP;
 }
-bool input::isReleased(Uint8 key)
+bool input::isReleased(SDLKey key)
 {
     return keyState[key] == isR || keyState[key] == wasR;
 }
 
-bool input::wasPressed(Uint8 key)
+bool input::wasPressed(SDLKey key)
 {
     return keyState[key] == wasP;
 }
-bool input::wasReleased(Uint8 key)
+bool input::wasReleased(SDLKey key)
 {
     return keyState[key] == wasR;
 }