简体   繁体   English

在小地图中旋转玩家

[英]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:(以下代码根本不旋转:( player.png(箭头图标)始终仅指向上方(默认位置):(

After a little searching the web i found these two sites:在搜索了 web 之后,我找到了这两个站点:

If i take a look into these codes it seems that you are missing a call to TranslateTransform before and after calling RotateTransform .如果我查看这些代码,您似乎在调用RotateTransform之前和之后都错过了对TranslateTransform的调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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