私は C# GDI+ でゲームを作ろうとしています。このために、画像を移動方向に回転させたいと考えています。
public Point PlayerPosition = new Point(320, 240);
public int PlayerDirection = 90;
public Bitmap PlayerImage;
PlayerImage = new Bitmap(Application.StartupPath + "\\Drake.png");
public void DrawPlayer(Graphics g)
{
Matrix rotMatrix = new Matrix();
rotMatrix.RotateAt((float)PlayerDirection, new PointF(PlayerPosition.X-17, (float)PlayerPosition.Y-27), MatrixOrder.Prepend);
g.Transform = rotMatrix;
g.DrawImage(PlayerImage , new Point(PlayerPosition.X-33,PlayerPosition.Y-70));
}
ただし、すべてのオブジェクトが画面上で回転します。画像ボックスに描画したこの 1 つの画像を回転させるだけです。