fix aspect ratio of hex grid
This commit is contained in:
parent
3d77ab264b
commit
cc1604fe36
|
@ -565,6 +565,15 @@
|
|||
" size_hint: 1, .33\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
|
|
4
main.py
4
main.py
|
@ -48,12 +48,10 @@ class StrategyGame(FloatLayout):
|
|||
|
||||
|
||||
class HexMapCell(label.Label):
|
||||
|
||||
def __init__(self, row=0, col=0, **kwargs):
|
||||
self.region_in_map = MapCoords(row, col)
|
||||
super(HexMapCell, self).__init__(**kwargs)
|
||||
self.size_hint = (1,None)
|
||||
self.height = self.width / math.sqrt(3)
|
||||
|
||||
|
||||
class BU(HexMapCell):
|
||||
pass
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
#:import math math
|
||||
#:include debug.kv
|
||||
|
||||
<StrategyGame>:
|
||||
id: _game
|
||||
main_map: _main_map
|
||||
map_rows: 10
|
||||
map_rows: 30
|
||||
map_cols: 10
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
|
@ -23,6 +23,7 @@
|
|||
text: 'mini-map'
|
||||
size_hint: 1, .33
|
||||
|
||||
|
||||
<BU>:
|
||||
canvas:
|
||||
Color:
|
||||
|
@ -51,3 +52,7 @@
|
|||
Line:
|
||||
points: (self.right, self.y, self.right, self.top)
|
||||
width: 2
|
||||
|
||||
<HexMapCell>:
|
||||
size_hint: 1, None
|
||||
height: self.width / math.sqrt(3)
|
||||
|
|
Loading…
Reference in New Issue