diff --git a/selfdrive/ui/layouts/home.py b/selfdrive/ui/layouts/home.py index 05ba1a3b..18c6c235 100644 --- a/selfdrive/ui/layouts/home.py +++ b/selfdrive/ui/layouts/home.py @@ -183,12 +183,25 @@ class HomeLayout(Widget): def _render_home_content(self): # Display welcome text centered in content area font = gui_app.font(FontWeight.BOLD) + light_font = gui_app.font(FontWeight.NORMAL) text = "欢迎选用 MR.ONE" + subtitle = "这不是自动驾驶,请注意行车安全!" font_size = 120 + sub_font_size = 50 + text_size = measure_text_cached(font, text, font_size) - x = self.content_rect.x + (self.content_rect.width - text_size.x) / 2 - y = self.content_rect.y + (self.content_rect.height - text_size.y) / 2 - rl.draw_text_ex(font, text, rl.Vector2(int(x), int(y)), font_size, 0, rl.WHITE) + sub_size = measure_text_cached(light_font, subtitle, sub_font_size) + + cx = self.content_rect.x + self.content_rect.width / 2 + cy = self.content_rect.y + self.content_rect.height / 2 + + x = int(cx - text_size.x / 2) + y = int(cy - text_size.y) + rl.draw_text_ex(font, text, rl.Vector2(x, y), font_size, 0, rl.WHITE) + + sx = int(cx - sub_size.x / 2) + sy = y + text_size.y + 30 + rl.draw_text_ex(light_font, subtitle, rl.Vector2(sx, sy), sub_font_size, 0, rl.Color(200, 200, 200, 255)) def _render_update_view(self): self.update_alert.render(self.content_rect)