aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-10-20 11:13:22 +0000
committerMax Horn2009-10-20 11:13:22 +0000
commit3fe7363d40f9ec87aedf126497f85ae3b88d25cc (patch)
tree5d80d914d083f1577bbbda05a4e8aed741560f09
parent50435d6bae2a89180676dbdbc83986d952ffb717 (diff)
downloadscummvm-rg350-3fe7363d40f9ec87aedf126497f85ae3b88d25cc.tar.gz
scummvm-rg350-3fe7363d40f9ec87aedf126497f85ae3b88d25cc.tar.bz2
scummvm-rg350-3fe7363d40f9ec87aedf126497f85ae3b88d25cc.zip
AGI: cleanup GfxMgr::testButton
svn-id: r45260
-rw-r--r--engines/agi/graphics.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index 020d228d82..3eba71fcb0 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -769,17 +769,8 @@ void GfxMgr::rawDrawButton(int x, int y, const char *s, int fgcolor, int bgcolor
int GfxMgr::testButton(int x, int y, const char *s) {
int len = strlen(s);
- int x1, y1, x2, y2;
-
- x1 = x - 3;
- y1 = y - 3;
- x2 = x + CHAR_COLS * len + 2;
- y2 = y + CHAR_LINES + 2;
-
- if ((int)_vm->_mouse.x >= x1 && (int)_vm->_mouse.y >= y1 && (int)_vm->_mouse.x < x2 && (int)_vm->_mouse.y <= y2)
- return true;
-
- return false;
+ Common::Rect rect(x - 3, y - 3, x + CHAR_COLS * len + 3, y + CHAR_LINES + 3);
+ return rect.contains(x, y);
}
void GfxMgr::putBlock(int x1, int y1, int x2, int y2) {