Class TSprite
An on-screen haptic object.
Namespace: Tanvas.TanvasTouch.Resources
Assembly: Tanvas.TanvasTouch.dll
Syntax
public sealed class TSprite : TResource
Remarks
TSprite is modeled on the sprite concept from computer graphics.
In computer graphics, a sprite references an image and a set of transformations -- e.g. translation, scaling, rotation -- that affect the way that image is rendered.
In TanvasTouch haptics, a TSprite defines a region within a TView that will present haptic effects via friction modulation. The TSprite's friction modulation -- its "image" -- is defined by TTexture and TMaterial, and a TSprite may be translated, scaled, and rotated.
A TSprite's position is relative to its associated TView, and the origin of a sprite is its top-left corner. Therefore, a TSprite at (0, 0) has its top-left corner coincident with the top-left corner of its associated TView. The X and Y axes increase to the right and downwards, respectively.
The TanvasTouch Engine expects a TSprite's position and size to be in the screen's coordinate system, but this is not yet enforced by the TanvasTouch API library: the application must perform these coordinate transformations. The v4 to v5 migration guide describes how to perform these transformations using WPF.
Constructors
TSprite()
Declaration
public TSprite()
Properties
Depth
The depth of the sprite on screen.
Declaration
public float Depth { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
Smaller depth values are closer to the screen surface. The default value is 0.
This is used to resolve rendering order of overlapped sprites: sprites with smaller depth values will be rendered above sprites with greater depth values.
If two sprites with identical depth values overlap, it is not defined which sprite will be rendered.
Enabled
Get or set whether the sprite is enabled.
Declaration
public bool Enabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The default value is true. A sprite that is not enabled does not render any haptic effects.
Height
The height of the sprite.
Declaration
public int Height { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
The default value is 0.
Material
This sprite's associated TMaterial.
Declaration
public TMaterial Material { get; set; }
Property Value
Type | Description |
---|---|
TMaterial |
Remarks
The texture mapping from the TMaterial will be conveyed onto the region defined by this sprite.
The TMaterial can be detached from the sprite by setting this property to null.
PivotX
The X coordinate of the pivot point of the sprite.
Declaration
public float PivotX { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
The default value is 0, i.e. the left edge of the sprite's view.
PivotY
The Y coordinate of the pivot point of the sprite.
Declaration
public float PivotY { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
The default value is 0, i.e. the top edge of the sprite's view.
Rotation
The rotation of the sprite around its pivot point, in radians.
Declaration
public float Rotation { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
The default value is 0. Rotation proceeds clockwise.
Width
The width of the sprite.
Declaration
public int Width { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
The default value is 0.
X
The X coordinate.
Declaration
public float X { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
The default value is 0.
A TSprite's position is relative to its associated TView. The origin of a sprite is its top-left corner.
Y
The Y coordinate.
Declaration
public float Y { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
The default value is 0.
A TSprite's position is relative to its associated TView. The origin of a sprite is its top-left corner.
Methods
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
ReleaseHandle()
Declaration
protected override void ReleaseHandle()