diff options
Diffstat (limited to 'Saludame.activity/main_window.py')
-rwxr-xr-x | Saludame.activity/main_window.py | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/Saludame.activity/main_window.py b/Saludame.activity/main_window.py index 1224789..09b90d9 100755 --- a/Saludame.activity/main_window.py +++ b/Saludame.activity/main_window.py @@ -21,37 +21,42 @@ class MainWindow(gui.Window): self.game_manager = game_man self.windows = [] # Lista de ventanas que 'componen' la ventana principal - + self.panel_win = PanelWindow(container, pygame.Rect((180, 609), (1015, 200)), 1, windows_controller) - self.windows.append(self.panel_win) + self.add_window(self.panel_win) self.kidW = KidWindow(container, pygame.Rect((227, 0), (973, 609)), 1, windows_controller, game_man) - self.windows.append(self.kidW) + self.add_window(self.kidW) - self.windows.append(animation.FPS(container, pygame.Rect((1150, 0), (50, 20)), 15, self.clock)) - self.windows.append(status_bars.BarsWindow(container, pygame.Rect(0, 0, 227, 590), 5, windows_controller, bars_loader)) + self.add_child(animation.FPS(container, pygame.Rect((1150, 0), (50, 20)), 15, self.clock)) + self.add_window(status_bars.BarsWindow(container, pygame.Rect(0, 0, 227, 590), 5, windows_controller, bars_loader)) self.add_child(Clock(container, pygame.Rect(0, 528, 1, 1), 1, game_man)) # Challenges challenges_button = gui.ImageButton(self.rect, pygame.Rect((1120, 400), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_mc_challenges) challenges_button.set_tooltip(_("Multiple choice")) + challenges_button.keep_dirty = True self.add_button(challenges_button) challenges_button2 = gui.ImageButton(self.rect, pygame.Rect((1120, 500), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_tf_challenges) challenges_button2.set_tooltip(_("True or false")) + challenges_button2.keep_dirty = True self.add_button(challenges_button2) challenges_button3 = gui.ImageButton(self.rect, pygame.Rect((1120, 300), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_master_challenge) challenges_button3.set_tooltip(_("Master challenge")) + challenges_button3.keep_dirty = True self.add_button(challenges_button3) challenges_button4 = gui.ImageButton(self.rect, pygame.Rect((1120, 200), (60, 60)), 1, "challenges/trophy.png", self._cb_button_click_cooking_challenge) challenges_button4.set_tooltip(_("Cooking")) + challenges_button4.keep_dirty = True self.add_button(challenges_button4) button_back = pygame.image.load("customization/customization_button.png").convert() btn_reset = gui.TextButton2(self.rect, pygame.Rect((1000, 20), (70, 30)), 1, _("Reset"), 30, (255, 255, 255), button_back, self._cb_reset_game) + btn_reset.keep_dirty = True self.add_button(btn_reset) #btn_change_mood = gui.ImageButton(self.rect, pygame.Rect((1120, 500), (60, 60)), 1, "assets/icons/change.png", self._cb_button_click_change_mood) @@ -108,17 +113,15 @@ class Clock(gui.Widget): self.set_frame() def set_frame(self): - self.frame = pygame.image.load(self.frame_paths[self.frame_index]).convert() - - def draw(self, screen): - change = gui.Widget.draw(self, screen) + image = pygame.image.load(self.frame_paths[self.frame_index]).convert() + rect = pygame.Rect((0,0), image.get_size()) + rect.center = self.rect_absolute.width/2, self.rect_absolute.height/2 + self.background.blit(image, rect) + def update(self, frames): if self.game_manager.hour <> self.frame_index: self.frame_index = self.game_manager.hour self.set_frame() - - rect = pygame.Rect((0, 0), self.frame.get_size()) - rect.center = self.rect_absolute.center - screen.blit(self.frame, rect) - - return change + + self.set_dirty() # Always dirty because it draws over the panel_window +
\ No newline at end of file |