X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=blobdiff_plain;f=src%2Finput%2FinputManager.cpp;h=ebbd72e67071a804a7690bccd4dd7fd4f1ec7a14;hb=7ffb6c2da6f41929a6f8043d2127f28122864110;hp=0df4baad73e9e249e46c156c23627a59d8bddffa;hpb=a823a80039c6069bb7676433832d9f9413494860;p=physics.git diff --git a/src/input/inputManager.cpp b/src/input/inputManager.cpp index 0df4baa..ebbd72e 100644 --- a/src/input/inputManager.cpp +++ b/src/input/inputManager.cpp @@ -74,14 +74,25 @@ void input::update() Vector2 input::mousePosition() { - int x; - int y; - + 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;