From d28e9b33addafb8e0873094c0639d1931a971718 Mon Sep 17 00:00:00 2001 From: Dorian Pula Date: Sat, 16 Jul 2016 18:16:08 -0400 Subject: [PATCH] Add ability to detect various button presses. --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 52fb444..65f17ad 100644 --- a/main.py +++ b/main.py @@ -28,7 +28,6 @@ class StrategyGame(FloatLayout): # Add overlay conditionally. if (row % 6 == 1 and col % 2 == 1) or (row % 6 == 4 and col % 2 == 0) and (col > 0): - hex_cell.visible_on_map = True # Determine the location of the solid hexagon cell. Needs to be offset from the centre of the hex. @@ -102,12 +101,14 @@ class HexMapCell(Label): self.selected = not self.selected with self.canvas.after: - if self.selected: + if self.selected and touch.button == 'left': Color(*kivy.utils.get_color_from_hex('#00FF00')) + elif self.selected and touch.button == 'right': + Color(*kivy.utils.get_color_from_hex('#FF0000')) else: Color(*kivy.utils.get_color_from_hex('#A1A5AA')) radius = 2 * self.height - self.ell = Line(circle=(self.x, self.y, radius, 0, 360, 6), width=2) + self.ell = Line(circle=(self.x, self.y, radius, 0, 360, 6), width=4) return True