diff libui/ui/gridmenu.c @ 192:4ad7420ab678

rpg: add minimalist battle system, continue #2477 @60h - Implement battle as states, - Add basic support for spells (no calculation yet), - Add won/lost state, - Add animations and messages, - Add order.
author David Demelier <markand@malikania.fr>
date Sat, 07 Nov 2020 16:00:39 +0100
parents 867b60e6258a
children 76afe639fd72
line wrap: on
line diff
--- a/libui/ui/gridmenu.c	Sat Nov 07 15:40:34 2020 +0100
+++ b/libui/ui/gridmenu.c	Sat Nov 07 16:00:39 2020 +0100
@@ -194,7 +194,7 @@
 			menu->selected -= 1;
 		break;
 	case KEY_ENTER:
-		menu->state = GRIDMENU_STATE_SELECTED;
+		menu->state = GRIDMENU_STATE_ACTIVATED;
 		break;
 	default:
 		break;
@@ -224,8 +224,11 @@
 		}
 	}
 
-	if (save != menu->selected)
+	/* A click immediately active the widget. */
+	if (save != menu->selected) {
 		gridmenu_repaint(menu);
+		menu->state = GRIDMENU_STATE_ACTIVATED;
+	}
 }
 
 void