Sprite Class

Language:

Provides methods and properties that simplify the process of drawing sprites using Microsoft Direct3D.

Definition

Visual Basic NotInheritable Public Class Sprite
    Inherits MarshalByRefObject
    Implements IDisposable
C# public sealed class Sprite : MarshalByRefObject, IDisposable
C++ public ref class Sprite sealed : MarshalByRefObject, IDisposable
JScript public final class Sprite extends MarshalByRefObject implements IDisposable

Members Table

Event Description
Disposing Occurs when the Dispose method is called or when the Sprite object is finalized and collected by the garbage collector of the .NET common language runtime.
Lost Occurs when an object is lost, normally immediately prior to a device reset.
Reset Occurs after the Sprite.OnResetDevice method is called or after the Device is reset.
Method Description
Begin Prepares a device for drawing sprites.
Dispose Immediately releases the unmanaged resources used by the Sprite object.
Draw Adds a sprite to the list of batched sprites.
Draw2D Adds a sprite to the list of batched sprites. Used for presentation in 2-D space.
End Restores the device to the state it was in before Sprite.Begin was called.
Equals Returns a value that indicates whether the current instance is equal to a specified object.
Finalize Allows the Sprite object to free resources before it is destroyed by the garbage collector.
Flush Forces all batched sprites to be submitted to the device.
GetHashCode Returns the hash code for the current instance.
GetObjectByValue This member supports the infrastructure for Microsoft DirectX 9.0 for Managed Code and is not intended to be used directly from your code.
OnLostDevice Releases all references to video memory resources and deletes all state blocks.
OnResetDevice Should be called after the device is reset and before any other methods are called, if Device.IsUsingEventHandlers is set to false.
static (Shared in Visual Basic) op_Equality Compares the current instance of a class to another instance to determine whether they are the same.
static (Shared in Visual Basic) op_Inequality Compares the current instance of a class to another instance to determine whether they are different.
raise_Disposing Raises the Microsoft.DirectX.Direct3D.Sprite.Disposing event when called from within a derived class.
raise_Lost Raises a Sprite.Lost event when called from within a derived class.
raise_Reset Raises a Sprite.Reset event when called from within a derived class.
SetWorldViewLH Sets the left-handed world-view transform for a sprite.

A call to this method is required before billboarding or sorting sprites.
SetWorldViewRH Sets the right-handed world-view transform for a sprite.

A call to this method is required before billboarding or sorting sprites.
Sprite Initializes a new instance of the Sprite class.
UpdateUnmanagedPointer Updates the unmanaged pointer for this Sprite object. This method supports the Microsoft .NET Framework infrastructure and is not intended to be used directly in your code.
Property Description
Device Retrieves the Direct3D device associated with a sprite object.
Disposed Gets a value that indicates whether the object is disposed.
Transform Retrieves or sets a Matrix object.
UnmanagedComPointer Returns the unmanaged Component Object Model (COM) ID3DXSprite interface pointer.

Inheritance Hierarchy

Object Leave Site
MarshalByRefObject Leave Site
Sprite

Remarks

Typically, the application first calls Sprite.Begin, which allows control over the device render state, alpha blending, and sprite transformation and sorting. Then, for each sprite to display, the application calls Sprite.Draw, which can be called repeatedly to store any number of sprites. To display the batched sprites to the device, the application calls Sprite.End or Sprite.Flush.

Class Information

Namespace Microsoft.DirectX.Direct3D
Assembly Microsoft.DirectX.Direct3DX (microsoft.directx.direct3dx.dll)
Strong Name Microsoft.DirectX.Direct3DX,  Version=1.0.900.0,  Culture=neutral,  PublicKeyToken=d3231b57b74a1492

Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center