diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-24 17:29:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-25 22:08:19 +0300 |
commit | 14f55eb8c6e44763e70046b9661bd056280226a5 (patch) | |
tree | d255d2765b33f10f2928fa4da3f0bd45f477cea6 /src/gui/gui.cpp | |
parent | e42d8efbde5c2a560d3ed47347281422a76be22f (diff) | |
download | mv-14f55eb8c6e44763e70046b9661bd056280226a5.tar.gz mv-14f55eb8c6e44763e70046b9661bd056280226a5.tar.bz2 mv-14f55eb8c6e44763e70046b9661bd056280226a5.tar.xz mv-14f55eb8c6e44763e70046b9661bd056280226a5.zip |
Add missing non null attributes into gui directory.
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r-- | src/gui/gui.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index ac61261d3..91224b714 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -470,7 +470,7 @@ void Gui::draw() int mouseX; int mouseY; - const MouseStateType button = getMouseState(&mouseX, &mouseY); + const MouseStateType button = getMouseState(mouseX, mouseY); if ((settings.mouseFocused || button & SDL_BUTTON(1)) && mMouseCursors && mCustomCursor && mMouseCursorAlpha > 0.0F) @@ -942,7 +942,7 @@ MouseEvent *Gui::createMouseEvent(Window *const widget) int mouseY = 0; getAbsolutePosition(widget, x, y); - getMouseState(&mouseX, &mouseY); + getMouseState(mouseX, mouseY); return new MouseEvent(widget, MouseEventType::MOVED, @@ -953,8 +953,11 @@ MouseEvent *Gui::createMouseEvent(Window *const widget) } void Gui::getAbsolutePosition(Widget *restrict widget, - int &restrict x, int &restrict y) + int &restrict x, + int &restrict y) { + if (!widget) + return; x = 0; y = 0; while (widget->getParent()) @@ -1103,12 +1106,12 @@ void Gui::removeDragged(const Widget *const widget) mFocusHandler->setDraggedWidget(nullptr); } -MouseStateType Gui::getMouseState(int *const x, int *const y) +MouseStateType Gui::getMouseState(int &x, int &y) { - const MouseStateType res = SDL_GetMouseState(x, y); + const MouseStateType res = SDL_GetMouseState(&x, &y); const int scale = mainGraphics->getScale(); - (*x) /= scale; - (*y) /= scale; + x /= scale; + y /= scale; return res; } |