diff options
Diffstat (limited to '')
-rw-r--r-- | gui/mousecursor.cpp | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/gui/mousecursor.cpp b/gui/mousecursor.cpp index bd730df6b..b87cac414 100644 --- a/gui/mousecursor.cpp +++ b/gui/mousecursor.cpp @@ -1,3 +1,21 @@ +/* + Copyright 2017 TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + TWRP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with TWRP. If not, see <http://www.gnu.org/licenses/>. +*/ + #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -52,15 +70,15 @@ void MouseCursor::LoadData(xml_node<>* node) xml_node<>* child; child = FindNode(node, "placement"); - if(child) + if (child) LoadPlacement(child, &mRenderX, &mRenderY, &mRenderW, &mRenderH); child = FindNode(node, "background"); - if(child) + if (child) { m_color = LoadAttrColor(child, "color", m_color); m_image = LoadAttrImage(child, "resource"); - if(m_image) + if (m_image) { mRenderW = m_image->GetWidth(); mRenderH = m_image->GetHeight(); @@ -68,20 +86,20 @@ void MouseCursor::LoadData(xml_node<>* node) } child = FindNode(node, "speed"); - if(child) + if (child) { attr = child->first_attribute("multiplier"); - if(attr) + if (attr) m_speedMultiplier = atof(attr->value()); } } int MouseCursor::Render(void) { - if(!m_present) + if (!m_present) return 0; - if(m_image) + if (m_image) { gr_blit(m_image->GetResource(), 0, 0, mRenderW, mRenderH, mRenderX, mRenderY); } @@ -95,15 +113,15 @@ int MouseCursor::Render(void) int MouseCursor::Update(void) { - if(m_present != ev_has_mouse()) + if (m_present != ev_has_mouse()) { m_present = ev_has_mouse(); - if(m_present) + if (m_present) SetRenderPos(m_resX/2, m_resY/2); return 2; } - if(m_present && m_moved) + if (m_present && m_moved) { m_moved = false; return 2; @@ -113,7 +131,7 @@ int MouseCursor::Update(void) int MouseCursor::SetRenderPos(int x, int y, int w, int h) { - if(x == mRenderX && y == mRenderY) + if (x == mRenderX && y == mRenderY) m_moved = true; return RenderObject::SetRenderPos(x, y, w, h); @@ -121,7 +139,7 @@ int MouseCursor::SetRenderPos(int x, int y, int w, int h) void MouseCursor::Move(int deltaX, int deltaY) { - if(deltaX != 0) + if (deltaX != 0) { mRenderX += deltaX*m_speedMultiplier; mRenderX = (std::min)(mRenderX, m_resX); @@ -130,7 +148,7 @@ void MouseCursor::Move(int deltaX, int deltaY) m_moved = true; } - if(deltaY != 0) + if (deltaY != 0) { mRenderY += deltaY*m_speedMultiplier; mRenderY = (std::min)(mRenderY, m_resY); |