简体   繁体   中英

rotating player in minimap

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM