[gnome-games/wip/aplazas/gamepad-events: 1/2] gamepad: Comment the hat mapping parsing
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/aplazas/gamepad-events: 1/2] gamepad: Comment the hat mapping parsing
- Date: Mon, 22 May 2017 09:05:46 +0000 (UTC)
commit 616197d9cb5a26a187f749e4cf6e4a2068a75e95
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon May 15 14:51:42 2017 +0200
gamepad: Comment the hat mapping parsing
Comment how the mappings are parsed, making them more undertandable.
src/gamepad/gamepad-mapping.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/gamepad/gamepad-mapping.c b/src/gamepad/gamepad-mapping.c
index 2327567..d17d306 100644
--- a/src/gamepad/gamepad-mapping.c
+++ b/src/gamepad/gamepad-mapping.c
@@ -54,6 +54,14 @@ parse_dpad_source (GamesGamepadMapping *self,
g_strfreev (dpad_parse_array);
+ /* Convert the value of dpad_position_2pow into an index:
+ * - 0001 = 1 => 1 = up
+ * - 0010 = 2 => 2 = right
+ * - 0100 = 4 => 3 = down
+ * - 1000 = 8 => 4 = left
+ *
+ * Anything else is an error.
+ */
while (dpad_position_2pow > 1) {
dpad_position_2pow >>= 1;
dpad_position++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]