Ejemplo n.º 1
0
 def on_window_resize(self, width, height):
     super().on_window_resize(width, height)
     self.shop_stages_cells_position = (
         self.viewport.x1 + get_top_bar_height(self.screen_resolution) // 4,
         self.viewport.y1 + get_top_bar_height(self.screen_resolution) // 4)
     self.shop_stages_cells_size = (
         (self.viewport.x2 - self.viewport.x1) -
         get_top_bar_height(self.screen_resolution) // 2,
         3 * get_bottom_bar_height(self.screen_resolution) -
         get_bottom_bar_height(self.screen_resolution) // 8)
Ejemplo n.º 2
0
 def on_window_resize(self, width, height):
     self.screen_resolution = width, height
     self.viewport.x1 \
         = self.parent_viewport.x1 + (self.column + 1) * (self.parent_viewport.x2 - self.parent_viewport.x1) // 4
     self.viewport.x2 = self.viewport.x1 + (self.parent_viewport.x2 -
                                            self.parent_viewport.x1) // 2
     mid_line = (self.parent_viewport.y1 + get_bottom_bar_height(
         self.screen_resolution) + self.parent_viewport.y2 -
                 get_top_bar_height(self.screen_resolution)) // 2
     self.viewport.y1 \
         = mid_line + self.row * (5 * get_top_bar_height(self.screen_resolution) // 8) \
         - get_top_bar_height(self.screen_resolution) // 2
     self.viewport.y2 \
         = mid_line + self.row * (5 * get_top_bar_height(self.screen_resolution) // 8) \
         + get_top_bar_height(self.screen_resolution) // 2
Ejemplo n.º 3
0
 def on_window_resize(self, width, height):
     super().on_window_resize(width, height)
     self.viewport.x1 = (self.parent_viewport.x1 + self.parent_viewport.x2) // 2 \
         - 5 * get_top_bar_height(self.screen_resolution)
     self.viewport.x2 = (self.parent_viewport.x1 + self.parent_viewport.x2) // 2 \
         + 5 * get_top_bar_height(self.screen_resolution)
     self.viewport.y1 = (
             self.parent_viewport.y1 + get_bottom_bar_height(self.screen_resolution)
             + self.parent_viewport.y2 - get_top_bar_height(self.screen_resolution)
         ) // 2 - 5 * get_bottom_bar_height(self.screen_resolution) // 8 \
         - get_bottom_bar_height(self.screen_resolution) // 2
     self.viewport.y2 = (
             self.parent_viewport.y1 + get_bottom_bar_height(self.screen_resolution)
             + self.parent_viewport.y2 - get_top_bar_height(self.screen_resolution)
         ) // 2 - 5 * get_bottom_bar_height(self.screen_resolution) // 8 \
         + get_bottom_bar_height(self.screen_resolution) // 2
Ejemplo n.º 4
0
 def on_window_resize(self, width, height):
     self.screen_resolution = width, height
     top_bar_height = get_top_bar_height(self.screen_resolution)
     self.viewport.x1 \
         = self.parent_viewport.x1 + self.map_id * ((self.parent_viewport.x2 - self.parent_viewport.x1) // 2 - 1)
     self.viewport.x2 = self.viewport.x1 + (self.parent_viewport.x2 - self.parent_viewport.x1) // 2 + 1
     self.viewport.y1 = self.parent_viewport.y1
     self.viewport.y2 = self.parent_viewport.y2 - top_bar_height + 2
Ejemplo n.º 5
0
    def on_window_resize(self, width, height):
        # recalculating base offset before applying new screen resolution
        if self.screen_resolution > (0, 0):
            self.on_recalculate_base_offset_for_new_screen_resolution(
                (width, height))

        super().on_window_resize(width, height)
        self.base_offset_lower_left_limit = (
            self.viewport.x1,
            self.viewport.y1 + get_bottom_bar_height(self.screen_resolution))
        self.base_offset_upper_right_limit = (
            int(self.viewport.x2 - MAP_WIDTH * self.zoom),
            int(self.viewport.y2 - MAP_HEIGHT * self.zoom -
                get_top_bar_height(self.screen_resolution)))
        self.check_base_offset_limits()
        self.controller.on_save_and_commit_last_known_base_offset()
Ejemplo n.º 6
0
    def on_mouse_scroll(self, x, y, scroll_x, scroll_y):
        self.map_move_mode = True
        self.controller.on_activate_mini_map()
        MAP_CAMERA.zoom -= scroll_y * MAP_ZOOM_STEP
        self.on_recalculate_base_offset_for_new_zoom(MAP_CAMERA.zoom)
        self.base_offset_upper_right_limit = (
            int(self.viewport.x2 - MAP_WIDTH * MAP_CAMERA.zoom),
            int(self.viewport.y2 - MAP_HEIGHT * MAP_CAMERA.zoom -
                get_top_bar_height(self.screen_resolution)))
        self.check_base_offset_limits()
        self.controller.on_save_and_commit_last_known_base_offset()
        self.zoom = MAP_CAMERA.zoom
        for b in self.shop_buttons:
            b.on_change_scale()

        self.controller.on_save_and_commit_last_known_zoom()
        self.map_move_mode = False
        self.mini_map_timer = perf_counter()
 def get_font_size(self):
     return int(32 / 80 * get_top_bar_height(self.screen_resolution))
 def get_y(self):
     return self.parent_viewport.y1 + get_top_bar_height(
         self.screen_resolution) // 2
Ejemplo n.º 9
0
 def get_x(self):
     return self.parent_viewport.x2 - get_top_bar_height(self.screen_resolution) * 3 + 4
Ejemplo n.º 10
0
 def get_height(self):
     return get_top_bar_height(self.screen_resolution)
Ejemplo n.º 11
0
 def get_y(self):
     return self.parent_viewport.y2 - 13 * get_top_bar_height(self.screen_resolution) // 8 \
            - 4 * get_top_bar_height(self.screen_resolution) // 3
Ejemplo n.º 12
0
 def get_x(self):
     return (self.parent_viewport.x1 + self.parent_viewport.x2) // 2 - 4 * get_top_bar_height(self.screen_resolution)
Ejemplo n.º 13
0
 def _handle_if_cursor_is_over_the_app_header(*args, **kwargs):
     if args[1] in range(args[0].viewport.x1 + get_top_bar_height(args[0].screen_resolution) * 2,
                         args[0].viewport.x2 - get_top_bar_height(args[0].screen_resolution) * 3) \
             and args[2] in range(args[0].viewport.y2 - get_top_bar_height(args[0].screen_resolution),
                                  args[0].viewport.y2):
         fn(*args, **kwargs)
Ejemplo n.º 14
0
 def get_scale(self):
     return 0.6 * get_top_bar_height(self.screen_resolution) / float(self.texture.width)
Ejemplo n.º 15
0
 def get_y(self):
     return (
         self.parent_viewport.y1 + get_bottom_bar_height(self.screen_resolution)
         + self.parent_viewport.y2 - get_top_bar_height(self.screen_resolution)
     ) // 2 - 5 * get_bottom_bar_height(self.screen_resolution) // 4 \
            - get_bottom_bar_height(self.screen_resolution) // 2
Ejemplo n.º 16
0
 def get_mini_map_frame_height(self):
     return int((self.viewport.y2 - self.viewport.y1 -
                 get_bottom_bar_height(self.screen_resolution) -
                 get_top_bar_height(self.screen_resolution)) /
                (MAP_HEIGHT * MAP_CAMERA.zoom) *
                get_mini_map_height(self.screen_resolution))
Ejemplo n.º 17
0
 def get_y(self):
     return self.parent_viewport.y2 - 3 * get_top_bar_height(self.screen_resolution) // 2 \
         - get_bottom_bar_height(self.screen_resolution)
Ejemplo n.º 18
0
 def _enable_map_move_mode_if_cursor_is_on_the_map(*args, **kwargs):
     if args[1] in range(0, args[0].screen_resolution[0]) \
             and args[2] in range(get_bottom_bar_height(args[0].screen_resolution),
                                  args[0].screen_resolution[1] - get_top_bar_height(args[0].screen_resolution)):
         fn(*args, **kwargs)