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:
parent
993802f6a6
commit
a9d63d729e
2
thirdparty/sokol/sokol_app.h
vendored
2
thirdparty/sokol/sokol_app.h
vendored
@ -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) {
|
||||
|
@ -183,3 +183,12 @@ pub enum KeyCode {
|
||||
right_super = 347
|
||||
menu = 348
|
||||
}
|
||||
|
||||
pub enum TouchToolType {
|
||||
unknown
|
||||
finger
|
||||
stylus
|
||||
mouse
|
||||
eraser
|
||||
palm
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ pub:
|
||||
identifier u64
|
||||
pos_x f32
|
||||
pos_y f32
|
||||
tool_type TouchToolType
|
||||
changed bool
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user