Functions
Sprites

Functions

TANVASTOUCH_API int tanvastouch_add_sprite (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id, tanvastouch_resource_id sprite_id)
 
TANVASTOUCH_API int tanvastouch_remove_sprite (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id, tanvastouch_resource_id sprite_id)
 
TANVASTOUCH_API int tanvastouch_contains_sprite (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id, tanvastouch_resource_id sprite_id, bool *p_contains)
 
TANVASTOUCH_API int tanvastouch_get_sprite_count (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id, int *p_count)
 
TANVASTOUCH_API int tanvastouch_create_sprite (tanvastouch_ctx *ctx, tanvastouch_resource_id *p_sprite_id)
 
TANVASTOUCH_API int tanvastouch_destroy_sprite (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id)
 
TANVASTOUCH_API int tanvastouch_set_sprite_enabled (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, bool enabled)
 
TANVASTOUCH_API int tanvastouch_is_sprite_enabled (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, bool *p_enabled)
 
TANVASTOUCH_API int tanvastouch_set_sprite_position (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, float x, float y)
 
TANVASTOUCH_API int tanvastouch_get_sprite_position (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, float *p_x, float *p_y)
 
TANVASTOUCH_API int tanvastouch_set_sprite_size (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, int width, int height)
 
TANVASTOUCH_API int tanvastouch_get_sprite_size (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, int *p_width, int *p_height)
 
TANVASTOUCH_API int tanvastouch_set_sprite_rotation (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, float theta, float pivot_x, float pivot_y)
 
TANVASTOUCH_API int tanvastouch_get_sprite_theta (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, float *p_theta)
 
TANVASTOUCH_API int tanvastouch_get_sprite_pivot (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, float *p_pivot_x, float *p_pivot_y)
 
TANVASTOUCH_API int tanvastouch_set_sprite_material (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, tanvastouch_resource_id material_id)
 
TANVASTOUCH_API int tanvastouch_get_sprite_material (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, tanvastouch_resource_id *p_material_id)
 
TANVASTOUCH_API int tanvastouch_remove_sprite_material (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id)
 
TANVASTOUCH_API int tanvastouch_set_sprite_depth (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, float depth)
 
TANVASTOUCH_API int tanvastouch_get_sprite_depth (tanvastouch_ctx *ctx, tanvastouch_resource_id sprite_id, float *p_depth)
 

Detailed Description

Function Documentation

◆ tanvastouch_add_sprite()

TANVASTOUCH_API int tanvastouch_add_sprite ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id,
tanvastouch_resource_id  sprite_id 
)

Add a sprite to a view.

The sprite is positioned in its view's coordinate system; (0, 0) is the top-left corner of its parent view.

The view does not take ownership of the sprite: if the view is destroyed, the sprite will continue to exist.

See also
Haptic resources are positioned using the window system's rules
Parameters
ctxThe context to use.
view_idThe view to modify.
sprite_idThe sprite to add to the view.
Returns
Resource-related API call return value

◆ tanvastouch_contains_sprite()

TANVASTOUCH_API int tanvastouch_contains_sprite ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id,
tanvastouch_resource_id  sprite_id,
bool *  p_contains 
)

Get whether a sprite is contained in a view.

See also
Out-parameters are only written on success
Parameters
ctxThe context to use.
view_idThe view to query.
sprite_idThe sprite to query.
p_containsIs-contained storage.
Returns
Resource-related API call return value

◆ tanvastouch_create_sprite()

TANVASTOUCH_API int tanvastouch_create_sprite ( tanvastouch_ctx ctx,
tanvastouch_resource_id p_sprite_id 
)

Create a sprite.

A sprite starts at (0, 0) with size (0, 0) and a rotation of zero radians, with the pivot point at (0, 0). A sprite does not have an initial view.

The sprite is positioned in its view's coordinate system; (0, 0) is the top-left corner of its parent view.

See also
Haptic resources are positioned using the window system's rules
Out-parameters are only written on success
Parameters
ctxThe context to use.
p_sprite_idSprite ID storage.
Returns
Resource-related API call return value

◆ tanvastouch_destroy_sprite()

TANVASTOUCH_API int tanvastouch_destroy_sprite ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id 
)

Destroy a sprite.

The sprite ID is not modified by this function. It is safe to keep the sprite ID around, but any modifications or queries done with that ID will return TANVASTOUCH_ERROR_RESOURCE_UNKNOWN.

Destroying sprites does not destroy any materials or textures contained in that sprite.

Parameters
ctxThe context to use.
sprite_idThe sprite to destroy.
Returns
Resource-related API call return value

◆ tanvastouch_get_sprite_count()

TANVASTOUCH_API int tanvastouch_get_sprite_count ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id,
int *  p_count 
)

Get the number of sprites in a view.

Parameters
ctxThe context to use.
view_idThe view to query.
p_countStorage for the result.
Returns
Resource-related API call return value
Since
4.1.0

◆ tanvastouch_get_sprite_depth()

TANVASTOUCH_API int tanvastouch_get_sprite_depth ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
float *  p_depth 
)

Get a sprite's depth.

See also
Out-parameters are only written on success
Parameters
ctxThe context to use.
sprite_idThe sprite to query.
p_depthDepth storage.
Returns
Resource-related API call return value

◆ tanvastouch_get_sprite_material()

TANVASTOUCH_API int tanvastouch_get_sprite_material ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
tanvastouch_resource_id p_material_id 
)

Get the material ID set for the sprite.

Parameters
ctxThe context to use.
sprite_idThe sprite to query.
p_material_idOn success, will contain the material ID set for the sprite, or TANVASTOUCH_INVALID_RESOURCE_ID if the sprite does not have a material set.
Since
4.1.0

◆ tanvastouch_get_sprite_pivot()

TANVASTOUCH_API int tanvastouch_get_sprite_pivot ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
float *  p_pivot_x,
float *  p_pivot_y 
)

Return a sprite's pivot point.

The pivot point is specified in the coordinate system of the sprite's view.

See also
Haptic resources are positioned using the window system's rules
Parameters
ctxThe context to use.
sprite_idThe sprite to query.
p_pivot_xX-position storage.
p_pivot_yY-position storage.
Returns
Resource-related API call return value

◆ tanvastouch_get_sprite_position()

TANVASTOUCH_API int tanvastouch_get_sprite_position ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
float *  p_x,
float *  p_y 
)

Get the sprite's position.

See also
Haptic resources are positioned using the window system's rules
Out-parameters are only written on success
Parameters
ctxThe context to use.
sprite_idThe sprite to query.
p_xX-position storage.
p_yY-position storage.
Returns
Resource-related API call return value

◆ tanvastouch_get_sprite_size()

TANVASTOUCH_API int tanvastouch_get_sprite_size ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
int *  p_width,
int *  p_height 
)

Get a sprite's size.

See also
Haptic resources are positioned using the window system's rules
Out-parameters are only written on success
Parameters
ctxThe context to use.
sprite_idThe sprite to query.
p_widthWidth storage.
p_heightHeight storage.
Returns
Resource-related API call return value

◆ tanvastouch_get_sprite_theta()

TANVASTOUCH_API int tanvastouch_get_sprite_theta ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
float *  p_theta 
)

Return a sprite's angle.

The rotation angle is specified in radians; rotation proceeds clockwise.

Parameters
ctxThe context to use.
sprite_idThe sprite to modify.
p_thetaAngle storage.
Returns
Resource-related API call return value

◆ tanvastouch_is_sprite_enabled()

TANVASTOUCH_API int tanvastouch_is_sprite_enabled ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
bool *  p_enabled 
)

Get whether a sprite is enabled.

See also
Out-parameters are only written on success
Parameters
ctxThe context to use.
sprite_idThe sprite to query.
p_enabledIs-enabled storage.
Returns
Resource-related API call return value

◆ tanvastouch_remove_sprite()

TANVASTOUCH_API int tanvastouch_remove_sprite ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id,
tanvastouch_resource_id  sprite_id 
)

Remove a sprite from a view.

Parameters
ctxThe context to use.
view_idThe view to modify.
sprite_idThe sprite to remove from the view.
Returns
Resource-related API call return value

◆ tanvastouch_remove_sprite_material()

TANVASTOUCH_API int tanvastouch_remove_sprite_material ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id 
)

Clears a sprite's material.

If successful, subsequent calls to tanvastouch_get_sprite_material on the affected sprite will return TANVASTOUCH_INVALID_RESOURCE_ID.

Parameters
ctxThe context to use.
sprite_idThe sprite to modify.
Returns
Resource-related API call return value

◆ tanvastouch_set_sprite_depth()

TANVASTOUCH_API int tanvastouch_set_sprite_depth ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
float  depth 
)

Set a sprite's depth.

Depth zero is the closest to the screen; increasing depth means going deeper into the screen.

Parameters
ctxThe context to use.
sprite_idThe sprite to modify.
depthDesired depth.
Returns
Resource-related API call return value

◆ tanvastouch_set_sprite_enabled()

TANVASTOUCH_API int tanvastouch_set_sprite_enabled ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
bool  enabled 
)

Set whether the given sprite will participate in haptic rendering.

See also
Destructors do not clear resource IDs
Parameters
ctxThe context to use.
sprite_idThe sprite to modify.
enabledTrue to enable, false to disable.
Returns
Resource-related API call return value

◆ tanvastouch_set_sprite_material()

TANVASTOUCH_API int tanvastouch_set_sprite_material ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
tanvastouch_resource_id  material_id 
)

Set a sprite's material.

Parameters
ctxThe context to use.
sprite_idThe sprite to modify.
material_idThe material to assign.
Returns
Resource-related API call return value

◆ tanvastouch_set_sprite_position()

TANVASTOUCH_API int tanvastouch_set_sprite_position ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
float  x,
float  y 
)

Set a sprite's position.

The origin of the sprite's coordinate system is the top-left corner of its parent view. The origin of the sprite is its top-left corner.

See also
Haptic resources are positioned using the window system's rules
Parameters
ctxThe context to use.
sprite_idThe sprite to modify.
xX position.
yY position.
Returns
Resource-related API call return value

◆ tanvastouch_set_sprite_rotation()

TANVASTOUCH_API int tanvastouch_set_sprite_rotation ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
float  theta,
float  pivot_x,
float  pivot_y 
)

Set a sprite's rotation and pivot point.

The rotation angle is specified in radians; rotation proceeds clockwise. The pivot point is specified in the coordinate system of the sprite's view.

See also
Haptic resources are positioned using the window system's rules
Parameters
ctxThe context to use.
sprite_idThe sprite to modify.
thetaSprite angle.
pivot_xPivot point X.
pivot_yPivot point Y.
Returns
Resource-related API call return value

◆ tanvastouch_set_sprite_size()

TANVASTOUCH_API int tanvastouch_set_sprite_size ( tanvastouch_ctx ctx,
tanvastouch_resource_id  sprite_id,
int  width,
int  height 
)

Set a sprite's size.

See also
Haptic resources are positioned using the window system's rules
Parameters
ctxThe context to use.
sprite_idThe sprite to modify.
widthDesired width.
heightDesired height.
Returns
Resource-related API call return value