summaryrefslogtreecommitdiff
path: root/src/gui/viewport.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-01-14 14:54:39 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-01-14 14:54:39 +0000
commitf842e0b40d8382011f0bc46b1446945d99ac0425 (patch)
tree5ddbb7c146a8ece28a4260d788350b1c2cf0dbed /src/gui/viewport.cpp
parentcbbcc5489e2f72a76b66ae849cbe8f1dc44246ca (diff)
downloadmana-f842e0b40d8382011f0bc46b1446945d99ac0425.tar.gz
mana-f842e0b40d8382011f0bc46b1446945d99ac0425.tar.bz2
mana-f842e0b40d8382011f0bc46b1446945d99ac0425.tar.xz
mana-f842e0b40d8382011f0bc46b1446945d99ac0425.zip
Upgraded to Guichan 0.6.0 (merge from guichan-0.6.0 branch).
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 08ca5141..03e008ba 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -246,7 +246,7 @@ Viewport::logic()
}
void
-Viewport::mousePress(int mx, int my, int button)
+Viewport::mousePressed(gcn::MouseEvent &event)
{
// Check if we are alive and kickin'
if (!mMap || !player_node || player_node->mAction == Being::DEAD)
@@ -258,11 +258,11 @@ Viewport::mousePress(int mx, int my, int button)
mPlayerFollowMouse = false;
- int tilex = mx / 32 + mCameraX;
- int tiley = my / 32 + mCameraY;
+ int tilex = event.getX() / 32 + mCameraX;
+ int tiley = event.getY() / 32 + mCameraY;
// Right click might open a popup
- if (button == gcn::MouseInput::RIGHT)
+ if (event.getButton() == gcn::MouseEvent::RIGHT)
{
Being *being;
FloorItem *floorItem;
@@ -270,12 +270,12 @@ Viewport::mousePress(int mx, int my, int button)
if ((being = beingManager->findBeing(tilex, tiley)) &&
being->getType() != Being::LOCALPLAYER)
{
- showPopup(mx, my, being);
+ showPopup(event.getX(), event.getY(), being);
return;
}
else if((floorItem = floorItemManager->findByCoordinates(tilex, tiley)))
{
- showPopup(mx, my, floorItem);
+ showPopup(event.getX(), event.getY(), floorItem);
return;
}
}
@@ -289,7 +289,7 @@ Viewport::mousePress(int mx, int my, int button)
}
// Left click can cause different actions
- if (button == gcn::MouseInput::LEFT)
+ if (event.getButton() == gcn::MouseEvent::LEFT)
{
Being *being;
FloorItem *item;
@@ -333,8 +333,7 @@ Viewport::mousePress(int mx, int my, int button)
mPlayerFollowMouse = true;
}
}
-
- if (button == gcn::MouseInput::MIDDLE)
+ else if (event.getButton() == gcn::MouseEvent::MIDDLE)
{
// Find the being nearest to the clicked position
Being *target = beingManager->findNearestLivingBeing(
@@ -349,19 +348,21 @@ Viewport::mousePress(int mx, int my, int button)
}
void
-Viewport::mouseMotion(int mx, int my)
+Viewport::mouseMoved(gcn::MouseEvent &event)
{
if (!mMap || !player_node)
return;
if (mPlayerFollowMouse && mWalkTime == player_node->mWalkTime)
{
- player_node->setDestination(mx / 32 + mCameraX, my / 32 + mCameraY);
+ int destX = event.getX() / 32 + mCameraX;
+ int destY = event.getY() / 32 + mCameraY;
+ player_node->setDestination(destX, destY);
}
}
void
-Viewport::mouseRelease(int mx, int my, int button)
+Viewport::mouseReleased(gcn::MouseEvent &event)
{
mPlayerFollowMouse = false;
}