Click or drag to resize
Ab4d.SharpEngine logo

SpriteBatchDrawSprite(Vector2, Vector2, Single) Method

DrawSprite method draws the current texture to the specified position, size and and rotation (0 by default). When size is set to (0, 0), then the actual size of the texture is used. See remarks for more info.

Namespace: Ab4d.SharpEngine.Utilities
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public void DrawSprite(
	Vector2 topLeftPosition,
	Vector2 spriteSize,
	float rotationAngleDegrees = 0f
)

Parameters

topLeftPosition  Vector2
position as Vector2
spriteSize  Vector2
size of the sprite; when size is set to (0, 0), then the actual size of the texture is used.
rotationAngleDegrees  Single  (Optional)
clockwise rotation angle in degrees (0 by default)
Remarks

DrawSprite method draws the current texture to the specified position, size and and rotation (0 by default).

Before calling this method, the current texture must be set by calling the SetSpriteTexture(GpuImage) method.

When size is set to (0, 0), then the actual size of the texture is used.

The topLeftPosition can be specified in relative coordinates (valid range is from 0 to 1) or in absolute coordinates (valid range is from 0 to size of view). Absolute coordinates are supported only when the SpriteBatch is created from SceneView (in this case the AreAbsoluteCoordinatesSupported is true). To use absolute coordinates call Begin(Boolean, Int32) method and set useAbsoluteCoordinates parameter to true or set the IsUsingAbsoluteCoordinates property to true.

When rotationAngleDegrees is specified (0 by default), then the sprite is rotated around the center position.

When IsUsingDpiScale is true, then size of view is defined as (sceneView.Width / DpiScaleX, sceneView.Height / DpiScaleY). When IsUsingDpiScale is false (by default) then size of the view is the same as size of the SceneView.

See Also