Attempt to create multiple control points.

This commit is contained in:
Dorian 2016-06-04 17:57:52 -07:00
parent 7eb4b343a5
commit 02c84566cd
1 changed files with 10 additions and 6 deletions

16
main.py
View File

@ -26,8 +26,8 @@ class StrategyGame(FloatLayout):
self.main_map.add_widget(hex_cell) self.main_map.add_widget(hex_cell)
# Add overlay conditionally. # Add overlay conditionally.
# if (row % 6 == 2 and col % 2 == 0) or (row % 6 == 5 and col % 2 == 1): if (row % 6 == 2 and col % 2 == 0) or (row % 6 == 5 and col % 2 == 1):
if row == 2 and col == 0: print('({}, {})'.format(row, col))
self.add_widget(HexMapControlCell(hex_bind=hex_cell)) self.add_widget(HexMapControlCell(hex_bind=hex_cell))
@staticmethod @staticmethod
@ -58,12 +58,19 @@ class HexMapCell(label.Label):
super(HexMapCell, self).__init__(**kwargs) super(HexMapCell, self).__init__(**kwargs)
self.coords = MapCoords(row, col) self.coords = MapCoords(row, col)
class BU(HexMapCell): class BU(HexMapCell):
pass pass
class TD(HexMapCell): class TD(HexMapCell):
pass pass
class L(HexMapCell): class L(HexMapCell):
pass pass
class R(HexMapCell): class R(HexMapCell):
pass pass
@ -72,14 +79,11 @@ class HexMapControlCell(button.Button):
def __init__(self, hex_bind=None, **kwargs): def __init__(self, hex_bind=None, **kwargs):
super(HexMapControlCell, self).__init__(**kwargs) super(HexMapControlCell, self).__init__(**kwargs)
self.hex_bind = hex_bind self.hex_bind = hex_bind
# self.background_color = random.random(), random.random(), random.random(), 0.1
# self.background_color = random.random(), random.random(), random.random(), 0.25
self.background_color = random.random(), random.random(), random.random(), 1 self.background_color = random.random(), random.random(), random.random(), 1
self.bind(pos=self.reposition_control_cell, size=self.resize_control_cell) self.bind(pos=self.reposition_control_cell, size=self.resize_control_cell)
self.text = '({}, {})'.format(self.hex_bind.coords.row, self.hex_bind.coords.col)
def reposition_control_cell(self, obj, value): def reposition_control_cell(self, obj, value):
# import pdb
# pdb.set_trace()
self.pos = self.hex_bind.pos self.pos = self.hex_bind.pos
def resize_control_cell(self, obj, value): def resize_control_cell(self, obj, value):