@@ -135,42 +135,42 @@ def load_game(self, game_directory):
135
135
button_width = 120
136
136
button_height = 40
137
137
if self ._display .height < 200 :
138
- button_y /= 2
138
+ button_y // = 2
139
139
button_y += 10
140
- button_width /= 2
141
- button_height /= 2
142
- btn_right /= 2
143
- btn_mid /= 2
140
+ button_width // = 2
141
+ button_height // = 2
142
+ btn_right // = 2
143
+ btn_mid // = 2
144
144
elif self ._display .height > 250 :
145
- button_y *= 0.75
145
+ button_y = ( button_y * 3 ) // 4
146
146
button_y -= 20
147
- button_width *= 0.75
148
- button_height *= 0.75
149
- btn_right *= 0.75
150
- btn_mid *= 0.75
147
+ button_width = ( button_width * 3 ) // 4
148
+ button_height = ( button_height * 3 ) // 4
149
+ btn_right = ( btn_right * 3 ) // 4
150
+ btn_mid = ( btn_right * 3 ) // 4
151
151
self ._left_button = Button (
152
- x = int ( btn_left ) ,
153
- y = int ( button_y ) ,
154
- width = int ( button_width ) ,
155
- height = int ( button_height ) ,
152
+ x = btn_left ,
153
+ y = button_y ,
154
+ width = button_width ,
155
+ height = button_height ,
156
156
label = "Left" ,
157
157
label_font = self ._text_font ,
158
158
style = Button .SHADOWROUNDRECT ,
159
159
)
160
160
self ._right_button = Button (
161
- x = int ( btn_right ) ,
162
- y = int ( button_y ) ,
163
- width = int ( button_width ) ,
164
- height = int ( button_height ) ,
161
+ x = btn_right ,
162
+ y = button_y ,
163
+ width = button_width ,
164
+ height = button_height ,
165
165
label = "Right" ,
166
166
label_font = self ._text_font ,
167
167
style = Button .SHADOWROUNDRECT ,
168
168
)
169
169
self ._middle_button = Button (
170
- x = int ( btn_mid ) ,
171
- y = int ( button_y ) ,
172
- width = int ( button_width ) ,
173
- height = int ( button_height ) ,
170
+ x = btn_mid ,
171
+ y = button_y ,
172
+ width = button_width ,
173
+ height = button_height ,
174
174
label = "Middle" ,
175
175
label_font = self ._text_font ,
176
176
style = Button .SHADOWROUNDRECT ,
@@ -432,8 +432,7 @@ def backlight_fade(self, to_light):
432
432
"""Adjust the TFT backlight. Fade from one value to another"""
433
433
from_light = self ._display .brightness
434
434
from_light = int (from_light * 100 )
435
- to_light = max (0 , min (1.0 , to_light ))
436
- to_light = int (to_light * 100 )
435
+ to_light = max (0 , min (100 , to_light * 100 ))
437
436
delta = 1
438
437
if from_light > to_light :
439
438
delta = - 1
0 commit comments