Index: MapEdit.cpp =================================================================== RCS file: /cvsroot/glob2/glob2/src/MapEdit.cpp,v retrieving revision 1.84 diff -u -r1.84 MapEdit.cpp --- MapEdit.cpp 10 Oct 2003 13:01:23 -0000 1.84 +++ MapEdit.cpp 18 Oct 2003 15:56:15 -0000 @@ -305,10 +305,8 @@ drawMenu(); } -void MapEdit::handleMapClick() +void MapEdit::handleMapClick(int mx, int my) { - int mx=savedMx; - int my=savedMy; int winX, winW, winY, winH; static int ax=0, ay=0, atype=0; int x=ax, y=ay; @@ -451,11 +449,9 @@ ay=y; } -void MapEdit::handleMapClick(int mx, int my) +void MapEdit::handleMapClick() { - savedMx=mx; - savedMy=my; - handleMapClick(); + handleMapClick(savedMx, savedMy); } void MapEdit::paintCoordinates() @@ -471,21 +467,16 @@ if (editMode==EM_TERRAIN) game.map.displayToMapCaseUnaligned(mx, my, &px, &py, viewportX, viewportY); else - game.map.displayToMapCaseAligned(mx, my, &px, &py, viewportX, viewportY); - + game.map.displayToMapCaseAligned(mx, my, &px, &py, viewportX, viewportY); + std::string s = GAG::nsprintf("(%d, %d)", px, py); int w=font->getStringWidth(s.c_str()); - int h=font->getStringHeight(s.c_str()); - int x=mx-w; - int y=my-h; - int dx=x>?0; - int dy=y>?0; - int dw=x+w-dx; - int dh=y+h-dy; - - globalContainer->gfx->drawFilledRect(x, y, w, h, 0, 0, 0, 128); + int h=font->getStringHeight(s.c_str()); + int x=globalContainer->gfx->getW()-64-w/2; + int y=0; + globalContainer->gfx->drawString(x, y, font, s.c_str()); - globalContainer->gfx->updateRect(dx, dy, dw, dh); + globalContainer->gfx->updateRect(x, y, w, h); } } @@ -1308,6 +1299,7 @@ { int mx=event->motion.x; int my=event->motion.y; + paintCoordinates(mx, my); if (minimapPushed) { @@ -1514,7 +1506,7 @@ returnCode=(processEvent(&windowEvent) == -1) ? -1 : returnCode; // redraw on scroll - bool doRedraw=wasMouseMotion; + bool doRedraw=false; viewportX+=game.map.getW(); viewportY+=game.map.getH(); for (int i=0; i<9; i++) @@ -1534,8 +1526,8 @@ if (doRedraw) { drawMap(screenClip.x, screenClip.y, screenClip.w-128, screenClip.h, true, true); - paintCoordinates(); drawMiniMap(); + paintCoordinates(); } endTick=SDL_GetTicks();