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.
ctx | The context to use. |
view_id | The view to modify. |
sprite_id | The sprite to add to the view. |
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.
ctx | The context to use. |
view_id | The view to query. |
sprite_id | The sprite to query. |
p_contains | Is-contained storage. |
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.
ctx | The context to use. |
p_sprite_id | Sprite ID storage. |
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.
ctx | The context to use. |
sprite_id | The sprite to destroy. |
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.
ctx | The context to use. |
view_id | The view to query. |
p_count | Storage for the result. |
TANVASTOUCH_API int tanvastouch_get_sprite_depth | ( | tanvastouch_ctx * | ctx, |
tanvastouch_resource_id | sprite_id, | ||
float * | p_depth | ||
) |
Get a sprite's depth.
ctx | The context to use. |
sprite_id | The sprite to query. |
p_depth | Depth storage. |
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.
ctx | The context to use. |
sprite_id | The sprite to query. |
p_material_id | On success, will contain the material ID set for the sprite, or TANVASTOUCH_INVALID_RESOURCE_ID if the sprite does not have a material set. |
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.
ctx | The context to use. |
sprite_id | The sprite to query. |
p_pivot_x | X-position storage. |
p_pivot_y | Y-position storage. |
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.
ctx | The context to use. |
sprite_id | The sprite to query. |
p_x | X-position storage. |
p_y | Y-position storage. |
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.
ctx | The context to use. |
sprite_id | The sprite to query. |
p_width | Width storage. |
p_height | Height storage. |
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.
ctx | The context to use. |
sprite_id | The sprite to modify. |
p_theta | Angle storage. |
TANVASTOUCH_API int tanvastouch_is_sprite_enabled | ( | tanvastouch_ctx * | ctx, |
tanvastouch_resource_id | sprite_id, | ||
bool * | p_enabled | ||
) |
Get whether a sprite is enabled.
ctx | The context to use. |
sprite_id | The sprite to query. |
p_enabled | Is-enabled storage. |
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.
ctx | The context to use. |
view_id | The view to modify. |
sprite_id | The sprite to remove from the view. |
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.
ctx | The context to use. |
sprite_id | The sprite to modify. |
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.
ctx | The context to use. |
sprite_id | The sprite to modify. |
depth | Desired depth. |
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.
ctx | The context to use. |
sprite_id | The sprite to modify. |
enabled | True to enable, false to disable. |
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.
ctx | The context to use. |
sprite_id | The sprite to modify. |
material_id | The material to assign. |
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.
ctx | The context to use. |
sprite_id | The sprite to modify. |
x | X position. |
y | Y position. |
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.
ctx | The context to use. |
sprite_id | The sprite to modify. |
theta | Sprite angle. |
pivot_x | Pivot point X. |
pivot_y | Pivot point Y. |
TANVASTOUCH_API int tanvastouch_set_sprite_size | ( | tanvastouch_ctx * | ctx, |
tanvastouch_resource_id | sprite_id, | ||
int | width, | ||
int | height | ||
) |
Set a sprite's size.
ctx | The context to use. |
sprite_id | The sprite to modify. |
width | Desired width. |
height | Desired height. |