Functions
Views

Functions

TANVASTOUCH_API int tanvastouch_create_view (tanvastouch_ctx *ctx, tanvastouch_resource_id *p_view_id)
 
TANVASTOUCH_API int tanvastouch_destroy_view (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id)
 
TANVASTOUCH_API int tanvastouch_set_view_enabled (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id, bool enabled)
 
TANVASTOUCH_API int tanvastouch_is_view_enabled (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id, bool *p_enabled)
 
TANVASTOUCH_API int tanvastouch_set_view_position_on_desktop (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id, float x, float y)
 
TANVASTOUCH_API int tanvastouch_get_view_position (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id, float *p_x, float *p_y)
 
TANVASTOUCH_API int tanvastouch_set_view_size (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id, int width, int height)
 
TANVASTOUCH_API int tanvastouch_get_view_size (tanvastouch_ctx *ctx, tanvastouch_resource_id view_id, int *p_width, int *p_height)
 

Detailed Description

Function Documentation

◆ tanvastouch_create_view()

TANVASTOUCH_API int tanvastouch_create_view ( tanvastouch_ctx ctx,
tanvastouch_resource_id p_view_id 
)

Create a view.

A view starts in an enabled state. The view is initially positioned at (0, 0), and has a size of (INT_MAX, INT_MAX).

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_view_idStorage for the new view's ID.
Returns
Resource-related API call return value

◆ tanvastouch_destroy_view()

TANVASTOUCH_API int tanvastouch_destroy_view ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id 
)

Destroy a view.

Destroying views does not destroy any sprites contained in that view.

See also
Destructors do not clear resource IDs
Parameters
ctxThe context to use.
view_idThe view to destroy.
Returns
Resource-related API call return value

◆ tanvastouch_get_view_position()

TANVASTOUCH_API int tanvastouch_get_view_position ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id,
float *  p_x,
float *  p_y 
)

Get a view's position.

See also
Haptic resources are positioned using the window system's rules
Parameters
ctxThe context to use.
view_idThe view to query.
p_xStorage for the X position.
p_yStorage for the Y position.
Returns
Resource-related API call return value

◆ tanvastouch_get_view_size()

TANVASTOUCH_API int tanvastouch_get_view_size ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id,
int *  p_width,
int *  p_height 
)

Get a view'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.
view_idThe view to query.
p_widthWidth storage.
p_heightHeight storage.
Returns
Resource-related API call return value

◆ tanvastouch_is_view_enabled()

TANVASTOUCH_API int tanvastouch_is_view_enabled ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id,
bool *  p_enabled 
)

Get whether a view will participate in haptic rendering.

See also
Out-parameters are only written on success
Parameters
ctxThe context to use.
view_idThe view to query.
p_enabledStorage for the status.
Returns
Resource-related API call return value

◆ tanvastouch_set_view_enabled()

TANVASTOUCH_API int tanvastouch_set_view_enabled ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id,
bool  enabled 
)

Set whether the given view will participate in haptic rendering.

Parameters
ctxThe context to use.
view_idThe view to modify.
enabledTrue to enable, false to disable.
Returns
Resource-related API call return value

◆ tanvastouch_set_view_position_on_desktop()

TANVASTOUCH_API int tanvastouch_set_view_position_on_desktop ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id,
float  x,
float  y 
)

Set a view's position.

Warning
Future releases of the engine may change views so that they use the coordinate system of the application window; i.e. (0, 0) may become the top-left corner of the application window. If this happens, a new function to set view position will be introduced, and this function will become deprecated.
See also
Haptic resources are positioned using the window system's rules
Parameters
ctxThe context to use.
view_idThe view to modify.
xX position.
yY position.
Returns
Resource-related API call return value

◆ tanvastouch_set_view_size()

TANVASTOUCH_API int tanvastouch_set_view_size ( tanvastouch_ctx ctx,
tanvastouch_resource_id  view_id,
int  width,
int  height 
)

Set a view's size.

Warning
As views are positioned relative to the desktop, views may extend outside the bounds of the application window. Currently, the engine will render haptics in these out-of-bounds regions, but this behavior will be eliminated in future versions.
See also
Haptic resources are positioned using the window system's rules
Parameters
ctxThe context to use.
view_idThe view to modify.
widthDesired width.
heightDesired height.
Returns
Resource-related API call return value