1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

sokol.sapp,gg: add a tool_type field to gg.TouchPoint (differenciate different types of touch input) (#15822)

This commit is contained in:
Wertzui123 2022-09-20 12:15:38 +02:00 committed by GitHub
parent 993802f6a6
commit a9d63d729e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -1230,6 +1230,7 @@ typedef struct sapp_touchpoint {
uintptr_t identifier;
float pos_x;
float pos_y;
int tool_type; // __v_
bool changed;
} sapp_touchpoint;
@ -8569,6 +8570,7 @@ _SOKOL_PRIVATE bool _sapp_android_touch_event(const AInputEvent* e) {
dst->identifier = (uintptr_t)AMotionEvent_getPointerId(e, (size_t)i);
dst->pos_x = (AMotionEvent_getRawX(e, (size_t)i) / _sapp.window_width) * _sapp.framebuffer_width;
dst->pos_y = (AMotionEvent_getRawY(e, (size_t)i) / _sapp.window_height) * _sapp.framebuffer_height;
dst->tool_type = AMotionEvent_getToolType(e, (size_t)i); // __v_
if (action == AMOTION_EVENT_ACTION_POINTER_DOWN ||
action == AMOTION_EVENT_ACTION_POINTER_UP) {

View File

@ -183,3 +183,12 @@ pub enum KeyCode {
right_super = 347
menu = 348
}
pub enum TouchToolType {
unknown
finger
stylus
mouse
eraser
palm
}

View File

@ -112,6 +112,7 @@ pub:
identifier u64
pos_x f32
pos_y f32
tool_type TouchToolType
changed bool
}