@@ -72,25 +72,6 @@ def __init__(self):
72
72
self ._button_group = displayio .Group (max_size = 2 )
73
73
self .root_group .append (self ._button_group )
74
74
75
- self ._text_font = bitmap_font .load_font ("Arial-Bold-12.bdf" )
76
- #self._text_font = fontio.BuiltinFont
77
- try :
78
- glyphs = b'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-!,. "\' ?!'
79
- print ("Preloading font glyphs:" , glyphs )
80
- self ._text_font .load_glyphs (glyphs )
81
- except AttributeError :
82
- pass # normal for built in font
83
-
84
- self ._left_button = Button (x = 10 , y = 195 , width = 120 , height = 40 ,
85
- label = "Left" , label_font = self ._text_font ,
86
- style = Button .SHADOWROUNDRECT )
87
- self ._right_button = Button (x = 190 , y = 195 , width = 120 , height = 40 ,
88
- label = "Right" , label_font = self ._text_font ,
89
- style = Button .SHADOWROUNDRECT )
90
- self ._middle_button = Button (x = 100 , y = 195 , width = 120 , height = 40 ,
91
- label = "Middle" , label_font = self ._text_font ,
92
- style = Button .SHADOWROUNDRECT )
93
-
94
75
self ._speaker_enable = DigitalInOut (board .SPEAKER_ENABLE )
95
76
self ._speaker_enable .switch_to_output (False )
96
77
self .audio = audioio .AudioOut (board .AUDIO_OUT )
@@ -112,6 +93,10 @@ def __init__(self):
112
93
self ._game = None
113
94
self ._text = None
114
95
self ._background_sprite = None
96
+ self ._text_font = None
97
+ self ._left_button = None
98
+ self ._right_button = None
99
+ self ._middle_button = None
115
100
116
101
117
102
def load_game (self , game_directory ):
@@ -121,6 +106,27 @@ def load_game(self, game_directory):
121
106
122
107
"""
123
108
self ._gamedirectory = game_directory
109
+
110
+ self ._text_font = bitmap_font .load_font (game_directory + "/fonts/Arial-Bold-12.bdf" )
111
+ #self._text_font = fontio.BuiltinFont
112
+ try :
113
+ glyphs = b'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-!,. "\' ?!'
114
+ print ("Preloading font glyphs:" , glyphs )
115
+ self ._text_font .load_glyphs (glyphs )
116
+ except AttributeError :
117
+ pass # normal for built in font
118
+
119
+ self ._left_button = Button (x = 10 , y = 195 , width = 120 , height = 40 ,
120
+ label = "Left" , label_font = self ._text_font ,
121
+ style = Button .SHADOWROUNDRECT )
122
+ self ._right_button = Button (x = 190 , y = 195 , width = 120 , height = 40 ,
123
+ label = "Right" , label_font = self ._text_font ,
124
+ style = Button .SHADOWROUNDRECT )
125
+ self ._middle_button = Button (x = 100 , y = 195 , width = 120 , height = 40 ,
126
+ label = "Middle" , label_font = self ._text_font ,
127
+ style = Button .SHADOWROUNDRECT )
128
+
129
+
124
130
self ._gamefilename = game_directory + "/cyoa.json"
125
131
try :
126
132
game_file = open (self ._gamefilename , "r" )
0 commit comments