def draw_exit(self): x = self.screen_x + self.al.mesh.offset.x y = self.screen_y + self.al.mesh.offset.y draw_box( screen=self.al.ui.screen, fonts=self.al.ui.fonts, font_size=16, x=x - 65, y=y + 50, width=150, height=50, string="Exit from here" if self.can_exit() else "Can't exit here", selected=self.hovers_over_exit and self.can_exit(), )
def draw_answer(self): answer_width = self.al.ui.percent_width(0.8) answer_height = self.al.ui.percent_height(0.1) draw_box( screen=self.al.ui.screen, fonts=self.al.ui.fonts, x=self.al.ui.width / 2 - answer_width / 2, y=self.answer_y, width=answer_width, height=answer_height, font_size=48, string=f" {self.answer}", centered=True, )
def draw(self): screen = self.al.ui.screen fonts = self.al.ui.fonts draw_box( screen, fonts, x=self.x, y=self.y, width=self.width, height=self.height, strings=[f"{self.tone_name} - {self.test_type}"] + self.test_description, bg=self.bg_color, default_color=self.color, font_size=16, thickness=1, )
def draw_distractors(self): draw_tooltip = False for box in self.boxes: box.draw( screen=self.al.ui.screen, fonts=self.al.ui.fonts, ) if self.selected_option_index == box.index and box.greyed and self.hover: draw_tooltip = True if draw_tooltip: draw_box( self.al.ui.screen, self.al.ui.fonts, x=self.hover[0], y=self.hover[1], font_size=24, width=self.al.ui.percent_width(0.3), height=self.al.ui.percent_height(0.07), string="You must first learn this letter!", thickness=3, )
def draw_best_link_destination(self, x, y): link = self.best_link if link: best_link_x = link.screen_x - link.width / 2 + self.al.mesh.offset.x best_link_y = link.screen_y - link.height / 2 + self.al.mesh.offset.y intersection_with_screen = get_intersection_with_screen_border( self.al, (x, y), (best_link_x, best_link_y)) if intersection_with_screen: int_x, int_y = intersection_with_screen if int_x >= self.al.ui.width - 100: int_x -= 100 if int_y == self.al.ui.height: int_y -= 60 color = SELECTED_COLOR_CLEANSED if link.state == CLEANSED else SELECTED_COLOR_CORRUPTED draw_box( screen=self.al.ui.screen, fonts=self.al.ui.fonts, font_size=12, x=int_x, y=int_y, string=link.thai, default_color=color, bg=(128, 128, 128), )