32
32
button_a = Debouncer (lambda : clue .button_a )
33
33
button_b = Debouncer (lambda : clue .button_b )
34
34
35
-
36
35
# Set up display
37
36
38
- display = board .DISPLAY
39
- selection_font = bitmap_font .load_font ('/Helvetica-Bold-36.bdf' )
40
- selection_font .load_glyphs (b'0123456789XDd' )
41
- selection_color = 0x0000FF
37
+ select_font = bitmap_font .load_font ('/Helvetica-Bold-36.bdf' )
38
+ select_font .load_glyphs (b'0123456789XDd' )
39
+ select_color = 0x0000FF
42
40
43
41
roll_font = bitmap_font .load_font ('/Anton-Regular-104.bdf' )
44
- roll_font .load_glyphs (b'0123456789XDd ' )
42
+ roll_font .load_glyphs (b'0123456789X ' )
45
43
roll_color = 0xFFFFFF
46
44
47
- selection_label = label .Label (selection_font , x = 0 , y = 25 , text = 'XdXXX' , color = selection_color )
45
+ select_label = label .Label (select_font , x = 0 , y = 25 , text = 'XdXXX' , color = select_color )
48
46
roll_label = label .Label (roll_font , x = 0 , y = 150 , text = 'XXX' , color = roll_color )
49
47
50
48
group = displayio .Group ()
51
- group .append (selection_label )
49
+ group .append (select_label )
52
50
group .append (roll_label )
53
51
54
- display .show (group )
52
+ board . DISPLAY .show (group )
55
53
56
54
# Helper functions
57
55
58
56
def roll (count , sides ):
59
57
for i in range (15 ):
60
- roll_value = sum ([randint (1 , sides ) for d in range (count + 1 )])
58
+ roll_value = sum ([randint (1 , sides ) for _ in range (count + 1 )])
61
59
roll_label .text = str (roll_value )
62
60
roll_label .x = 120 - (roll_label .bounding_box [2 ] // 2 )
63
61
duration = (i * 0.05 ) / 2
@@ -66,8 +64,8 @@ def roll(count, sides):
66
64
67
65
68
66
def update_display (count , sides ):
69
- selection_label .text = '{0}d{1}' .format (count + 1 , SIDES [sides ])
70
- selection_label .x = 120 - (selection_label .bounding_box [2 ] // 2 )
67
+ select_label .text = '{0}d{1}' .format (count + 1 , SIDES [sides ])
68
+ select_label .x = 120 - (select_label .bounding_box [2 ] // 2 )
71
69
roll_label .text = ''
72
70
73
71
0 commit comments