Show / Hide Table of Contents

Class TView

Groups TSprites.

Inheritance
System.Object
TResource
TView
Inherited Members
TResource.GUID
TResource.Dispose(Boolean)
TResource.Dispose()
Namespace: Tanvas.TanvasTouch.Resources
Assembly: Tanvas.TanvasTouch.dll
Syntax
public sealed class TView : TResource
Remarks

A TView contains references to TSprites. It can be used to group a set of TSprites into a single entity that can be enabled/disabled or moved all at once.

Multiple TViews can be active and on-screen simultaneously, but they should not overlap; if active TViews overlap, there is no guarantee which view will contribute to haptic rendering.

A TView does not own the TSprites inside of it, so disposing of the TView will not dispose of the associated TSprites as long as the TSprites are referenced elsewhere.

The TanvasTouch Engine expects a TView'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

TView()

Declaration
public TView()

Properties

Enabled

Get or set whether the view is enabled.

Declaration
public bool Enabled { get; set; }
Property Value
Type Description
System.Boolean
Remarks

If a view is disabled, the on-screen region it occupies will not contribute to haptic rendering unless it is overlapped by another view.

Height

The height of the view.

Declaration
public int Height { get; set; }
Property Value
Type Description
System.Int32

Width

The width of the view.

Declaration
public int Width { get; set; }
Property Value
Type Description
System.Int32

X

The X coordinate of the view. The default value is 0.

Declaration
public float X { get; set; }
Property Value
Type Description
System.Single

Y

The Y coordinate of the view. The default value is 0.

Declaration
public float Y { get; set; }
Property Value
Type Description
System.Single

Methods

AddSprite(TSprite)

Adds a sprite to the view.

Declaration
public void AddSprite(TSprite sprite)
Parameters
Type Name Description
TSprite sprite

The TSprite to be added to the view.

Remarks

If the TSprite is null or is already in the view, the function will do nothing.

Contains(TSprite)

Checks if a TSprite has been added to the view.

Declaration
public bool Contains(TSprite sprite)
Parameters
Type Name Description
TSprite sprite

The TSprite to examine.

Returns
Type Description
System.Boolean

True if the TSprite is in the view, false otherwise.

GetAllSprites()

Returns all TSprites in the view.

Declaration
public TSprite[] GetAllSprites()
Returns
Type Description
TSprite[]

An array of TSprites in the view.

Remarks

The returned array is a snapshot of the view's sprite state; therefore, the returned array will not contain TSprites added or removed after invoking GetAllSprites.

ReleaseHandle()

Declaration
protected override void ReleaseHandle()
Overrides
TResource.ReleaseHandle()

RemoveAllSprites()

Removes all the sprites that have been added to the view.

Declaration
public void RemoveAllSprites()

RemoveSprite(TSprite)

Removes a sprite from the view.

Declaration
public void RemoveSprite(TSprite sprite)
Parameters
Type Name Description
TSprite sprite

The TSprite to be removed from the view.

Remarks

If the TSprite is null or is not in the view, the function will do nothing.

Back to top Generated by DocFX