Add ability to detect various button presses.

This commit is contained in:
Dorian 2016-07-16 18:16:08 -04:00
parent 1ab95bbf6a
commit d28e9b33ad
1 changed files with 4 additions and 3 deletions

View File

@ -28,7 +28,6 @@ class StrategyGame(FloatLayout):
# Add overlay conditionally. # Add overlay conditionally.
if (row % 6 == 1 and col % 2 == 1) or (row % 6 == 4 and col % 2 == 0) and (col > 0): 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 hex_cell.visible_on_map = True
# Determine the location of the solid hexagon cell. Needs to be offset from the centre of the hex. # 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 self.selected = not self.selected
with self.canvas.after: with self.canvas.after:
if self.selected: if self.selected and touch.button == 'left':
Color(*kivy.utils.get_color_from_hex('#00FF00')) Color(*kivy.utils.get_color_from_hex('#00FF00'))
elif self.selected and touch.button == 'right':
Color(*kivy.utils.get_color_from_hex('#FF0000'))
else: else:
Color(*kivy.utils.get_color_from_hex('#A1A5AA')) Color(*kivy.utils.get_color_from_hex('#A1A5AA'))
radius = 2 * self.height 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 return True