X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=blobdiff_plain;f=src%2Finput%2FinputManager.cpp;h=ebbd72e67071a804a7690bccd4dd7fd4f1ec7a14;hb=7ffb6c2da6f41929a6f8043d2127f28122864110;hp=a8491b141561a778fd29930dd2ef89afcb3a41a4;hpb=e68f847b245153427266841ae724d602ca434c29;p=physics.git diff --git a/src/input/inputManager.cpp b/src/input/inputManager.cpp index a8491b1..ebbd72e 100644 --- a/src/input/inputManager.cpp +++ b/src/input/inputManager.cpp @@ -72,6 +72,27 @@ void input::update() } } +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(Uint8 key) { return keyState[key] == isP || keyState[key] == wasP;