projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
3821256
)
moved code for setting touch info for finger events to separate function
author
Holger Schemel
<info@artsoft.org>
Sun, 4 Oct 2020 22:52:23 +0000
(
00:52
+0200)
committer
Holger Schemel
<info@artsoft.org>
Sun, 4 Oct 2020 22:52:23 +0000
(
00:52
+0200)
src/events.c
patch
|
blob
|
history
diff --git
a/src/events.c
b/src/events.c
index f4311bfdee435c6701cc11f3feb8d2342d501cd6..41b60832fa50f92d165da235a709403b24d034d4 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-698,6
+698,16
@@
static struct
byte action;
} touch_info[NUM_TOUCH_FINGERS];
byte action;
} touch_info[NUM_TOUCH_FINGERS];
+static void SetTouchInfo(int pos, SDL_FingerID finger_id, int counter,
+ Key key, byte action)
+{
+ touch_info[pos].touched = (action != JOY_NO_ACTION);
+ touch_info[pos].finger_id = finger_id;
+ touch_info[pos].counter = counter;
+ touch_info[pos].key = key;
+ touch_info[pos].action = action;
+}
+
static void HandleFingerEvent_VirtualButtons(FingerEvent *event)
{
int x = event->x * overlay.grid_xsize;
static void HandleFingerEvent_VirtualButtons(FingerEvent *event)
{
int x = event->x * overlay.grid_xsize;
@@
-807,11
+817,7
@@
static void HandleFingerEvent_VirtualButtons(FingerEvent *event)
}
}
}
}
- touch_info[i].touched = TRUE;
- touch_info[i].finger_id = event->fingerId;
- touch_info[i].counter = Counter();
- touch_info[i].key = key;
- touch_info[i].action = grid_button_action;
+ SetTouchInfo(i, event->fingerId, Counter(), key, grid_button_action);
}
else
{
}
else
{
@@
-823,11
+829,7
@@
static void HandleFingerEvent_VirtualButtons(FingerEvent *event)
getKeyNameFromKey(touch_info[i].key), "KEY_RELEASED", i);
}
getKeyNameFromKey(touch_info[i].key), "KEY_RELEASED", i);
}
- touch_info[i].touched = FALSE;
- touch_info[i].finger_id = 0;
- touch_info[i].counter = 0;
- touch_info[i].key = 0;
- touch_info[i].action = JOY_NO_ACTION;
+ SetTouchInfo(i, 0, 0, 0, JOY_NO_ACTION);
}
}
}
}
}
}