def __draw_game(self, game, overview): color = self.data.config.scoreboard_colors.color("default.background") self.canvas.Fill(color["r"], color["g"], color["b"]) # Draw the pregame renderer if Status.is_pregame(overview.status): scoreboard = Scoreboard(overview) scroll_max_x = self.__max_scroll_x(self.data.config.layout.coords("pregame.scrolling_text")) pregame = Pregame(overview) renderer = PregameRenderer(self.canvas, pregame, scoreboard, self.data, self.scrolling_text_pos) self.__update_scrolling_text_pos(renderer.render()) # Draw the final game renderer elif Status.is_complete(overview.status): scroll_max_x = self.__max_scroll_x(self.data.config.layout.coords("final.scrolling_text")) final = Final(game) scoreboard = Scoreboard(overview) renderer = FinalRenderer(self.canvas, final, scoreboard, self.data, self.scrolling_text_pos) self.__update_scrolling_text_pos(renderer.render()) # Draw the scoreboar renderer elif Status.is_irregular(overview.status): scoreboard = Scoreboard(overview) if scoreboard.get_text_for_reason(): scroll_max_x = self.__max_scroll_x(self.data.config.layout.coords("status.scrolling_text")) renderer = StatusRenderer(self.canvas, scoreboard, self.data, self.scrolling_text_pos) self.__update_scrolling_text_pos(renderer.render()) else: StatusRenderer(self.canvas, scoreboard, self.data).render() else: scoreboard = Scoreboard(overview) ScoreboardRenderer(self.canvas, scoreboard, self.data).render() self.canvas = self.matrix.SwapOnVSync(self.canvas)
def __draw_game(self, game, overview): self.canvas.Fill(*ledcolors.scoreboard.fill) # Draw the pregame renderer if Status.is_pregame(overview.status): pregame = Pregame(overview) renderer = PregameRenderer(self.canvas, pregame, self.data.config.coords["pregame"], self.scrolling_text_pos) self.__update_scrolling_text_pos(renderer.render()) # Draw the final game renderer elif Status.is_complete(overview.status): final = Final(game) scoreboard = Scoreboard(overview) renderer = FinalRenderer(self.canvas, final, scoreboard, self.data.config, self.scrolling_text_pos) self.__update_scrolling_text_pos(renderer.render()) # Draw the scoreboar renderer elif Status.is_irregular(overview.status): scoreboard = Scoreboard(overview) StatusRenderer(self.canvas, scoreboard, self.data.config).render() else: scoreboard = Scoreboard(overview) ScoreboardRenderer(self.canvas, scoreboard, self.data.config).render() self.canvas = self.matrix.SwapOnVSync(self.canvas)
def __refresh_game(self, game, overview): """Draws the provided game on the canvas.""" if overview.status == PRE_GAME or overview.status == SCHEDULED or overview.status == WARMUP: pregame = Pregame(overview) renderer = PregameRenderer(self.canvas, pregame, self.current_scrolling_text_pos) self.__update_scrolling_text_pos(renderer.render()) elif overview.status == GAME_OVER or overview.status == FINAL: final = Final(game) scoreboard = Scoreboard(overview) renderer = FinalRenderer(self.canvas, final, scoreboard, self.current_scrolling_text_pos) self.__update_scrolling_text_pos(renderer.render()) elif overview.status == POSTPONED or overview.status == DELAYED: scoreboard = Scoreboard(overview) StatusRenderer(self.canvas, scoreboard).render() else: scoreboard = Scoreboard(overview) ScoreboardRenderer(self.canvas, scoreboard).render() self.canvas = self.matrix.SwapOnVSync(self.canvas)