Hey guys,
I'm currently working on tiling the minimap on a radar in c#, the loading of the tiles works pretty good at the moment, but there's a problem with algining the minimap with the players position.
Here a snapshot from the minimap of wow:
http://www.pictureupload.de/original...39_minimap.png
and here from the radar:
http://www.pictureupload.de/original...3125_radar.png
Like displayed on the screenshots, you can see that the position of the minimap isn't right in the radar.
I'm using the code from jbraumann's radar source to draw/load the minimap tiles into the radar.
This is the code of the function what algin the minimap with the players location:
Code:
private static Bitmap DrawMinimapOverlay(Bitmap img, Bitmap RadBit)
{
Graphics G = Graphics.FromImage(RadBit);
int cellBindpointX = (int)((((Math.Abs(ObjectMgr.LocalPlayer.X) % TILE_SCALE_FACTOR) / TILE_SCALE_FACTOR) * ZoomFactor) * 1);
int cellBindpointY = (int)((((Math.Abs(ObjectMgr.LocalPlayer.Y) % TILE_SCALE_FACTOR) / TILE_SCALE_FACTOR) * ZoomFactor) * 1);
if (ObjectMgr.LocalPlayer.X <= 0 && ObjectMgr.LocalPlayer.Y <= 0)
{
G.DrawImage(img, ((int)((RadarWidth) / 2) - cellBindpointX) - 1 * ZoomFactor, ((int)((RadarHeight) / 2) - cellBindpointY) - 1 * ZoomFactor);
}
else if (ObjectMgr.LocalPlayer.X >= 0 && ObjectMgr.LocalPlayer.Y <= 0)
{
G.DrawImage(img, ((int)((RadarWidth) / 2) + (cellBindpointX - ZoomFactor)) - 1 * ZoomFactor, ((int)((RadarHeight) / 2) - cellBindpointY) - 1 * ZoomFactor);
}
else if (ObjectMgr.LocalPlayer.X <= 0 && ObjectMgr.LocalPlayer.Y >= 0)
{
G.DrawImage(img, ((int)((RadarWidth) / 2) - cellBindpointX) - 1 * ZoomFactor, ((int)((RadarHeight) / 2) + (cellBindpointY - ZoomFactor)) - 1 * ZoomFactor);
}
else if (ObjectMgr.LocalPlayer.X >= 0 && ObjectMgr.LocalPlayer.Y >= 0)
{
G.DrawImage(img, ((int)((RadarWidth) / 2) + (cellBindpointX - ZoomFactor)) - 1 * ZoomFactor, ((int)((RadarHeight) / 2) + (cellBindpointY - ZoomFactor)) - 1 * ZoomFactor);
}
return img;
}
The underlined if clause is used everytime, but the algin of the drawing of it has a high wrongness.
Thats why I used the code in bold to make the screenshots above.
sorry for my broken english, its not my home country language.