added option to draw pressed virtual buttons highlighted
[rocksndiamonds.git] / src / events.c
index 9aad2bca87dfa837891244e5099d004c97a7d629..dd3e88af8721f49039488aba261eb8bc3f51c9ea 100644 (file)
@@ -682,6 +682,7 @@ void HandleFingerEvent_VirtualButtons(FingerEvent *event)
   int x = event->x * overlay.grid_xsize;
   int y = event->y * overlay.grid_ysize;
   int grid_button = overlay.grid_button[x][y];
+  int grid_button_action = GET_ACTION_FROM_GRID_BUTTON(grid_button);
   Key key = (grid_button == CHAR_GRID_BUTTON_LEFT  ? setup.input[0].key.left :
             grid_button == CHAR_GRID_BUTTON_RIGHT ? setup.input[0].key.right :
             grid_button == CHAR_GRID_BUTTON_UP    ? setup.input[0].key.up :
@@ -725,6 +726,11 @@ void HandleFingerEvent_VirtualButtons(FingerEvent *event)
   Error(ERR_DEBUG, "::: key '%s' was '%s' [fingerId: %lld]",
        getKeyNameFromKey(key), key_status_name, event->fingerId);
 
+  if (key_status == KEY_PRESSED)
+    overlay.grid_button_action |= grid_button_action;
+  else
+    overlay.grid_button_action &= ~grid_button_action;
+
   // check if we already know this touch event's finger id
   for (i = 0; i < NUM_TOUCH_FINGERS; i++)
   {