整数ではなく浮動小数点値を使用してXNA(C#)で線を引くにはどうすればよいですか?整数はポイントの後の値を削除するためです
のように:20.12
SpriteBatch.Draw (Texture2D, Vector2, Nullable<Rectangle>, Color, Single, Vector2, Vector2, SpriteEffects, Single)
メソッドを使用してみることができます。Texture2D
最初にラインを表すを作成する必要があります。
Vector2 pos = new Vector2(20.12F, 20.12F);
Vector2 scale = new Vector2(150.23F, 1);
Color myColor = Color.Blue;
Texture2D simpleTexture = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
// Draws a "line" with size (1, 1), at position (20.12, 20.12), with blue color, rotated by 45° (Pi/4), with origin at (0, 0) (the line will begin at 'pos'), scaled by (150.23, 1) (gives the line a size of (150.23, 1) )
this.spriteBatch.Draw(simpleTexture, pos, null, myColor, MathHelper.PiOver4, Vector2.Zero, scale, SpriteEffects.None, 0)
XNAを使用してから長い時間が経過しているため、これが機能することを保証することはできません。
とにかくお役に立てば幸いです。