Im trying to rotate player icon according to players facing.
Image pImage = Image.FromFile("player.png");
Bitmap pBitmap = new Bitmap(pImage.Width, pImage.Height);
Graphics gfx = Graphics.FromImage(pBitmap);
gfx.RotateTransform(10);
gfx.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
gfx.DrawImage(pImage, new Point(0, 0));
gfx.Dispose();
g.DrawImage(pImage, 150 - RADAR_ICON_WIDTH / 2, 150 - RADAR_ICON_HEIGHT / 2, RADAR_ICON_WIDTH, RADAR_ICON_HEIGHT);
the following code does not rotate at all :( the player.png (a arrowicon) is only pointing upwards (default position) at all times :(
After a little searching the web i found these two sites:
If i take a look into these codes it seems that you are missing a call to TranslateTransform
before and after calling RotateTransform
.