natiny_view_get_pointer
void natiny_view_get_pointer(NatinyView view, float* x, float* y);
Returns where the pointer is, measured from a view's top-left corner.
Parameters
| Name | Type | Description |
|---|---|---|
view |
NatinyView |
View handle |
x |
float* |
Receives the distance from the view's left edge, in drawing units; may be NULL |
y |
float* |
Receives the distance from the view's top edge, in drawing units; may be NULL |
Example
static void drag(NatinyView self, void* userdata) {
float* value = userdata;
float px, w;
natiny_view_get_pointer(self, &px, NULL);
natiny_view_get_rect(self, NULL, NULL, &w, NULL);
*value = px < 0.0f ? 0.0f : (px > w ? 1.0f : px / w);
}