Пример #1
0
    def _render_title(self):
        x = self.size[0] / 2

        if self.is_new_record:
            show_text(self.surface,
                      "New record!",
                      YELLOW,
                      50, (x, 60),
                      align_hor="center")
        else:
            show_text(self.surface,
                      "Mission clear!",
                      WHITE,
                      50, (x, 60),
                      align_hor="center")

        show_text(self.surface,
                  "Spent time:",
                  WHITE,
                  40, (x, 130),
                  align_hor="center")

        show_text(self.surface,
                  parse_time(self.time),
                  WHITE,
                  40, (x, 180),
                  align_hor="center")

        show_text(self.surface,
                  "Your name?",
                  WHITE,
                  40, (self.size[0] / 2, 280),
                  align_hor="center")
Пример #2
0
    def _render_mission_message(self, surface):
        msg = self.env.stage.get_mission_message()
        x = self.env.scene.get_bound()[0] / 2
        y = 100

        for i in range(0, len(msg)):
            show_text(surface, msg[i], WHITE, 50, (x, y + i * 90), align_hor="center")
Пример #3
0
    def render(self, surface):
        for i in range(0, len(self.stages)):
            stage = self.stages[i]
            color = YELLOW if self.cursor == i else GRAY

            text = "Stage {}".format(stage[0])

            bw, bh = self.option_background.get_rect().size
            x = self.position[0]
            y = self.position[1] + 150 * i

            surface.blit(self.option_background, (x, y))
            show_text(surface,
                      text,
                      color,
                      50, (int(x + bw / 2), int(y + bh / 2)),
                      align_hor="center",
                      align_ver="center")

            if stage[1] == "locked":
                lw, lh = self.lock_image.get_rect().size
                lx = int(x + (bw - lw) / 2)
                ly = int(y + (bh - lh) / 2)

                surface.blit(self.lock_cover, (x, y))
                surface.blit(self.lock_image, (lx, ly))
Пример #4
0
    def _render_title(self):
        x = self.size[0] / 2
        y = 70

        show_text(self.surface,
                  "RANKING",
                  TITLE_GRAY,
                  50, (x, y),
                  align_hor="center")
Пример #5
0
    def _render_text(self, surface):
        x = self.position[0] + self.size[0] / 2
        y = self.position[1] + self.size[1] / 2

        show_text(surface,
                  self.text,
                  self.color,
                  self.font_size, (x, y),
                  align_hor="center",
                  align_ver="center")
Пример #6
0
    def render(self, screen):
        bound = screen.get_size()
        width = bound[0]
        height = bound[1]

        show_text(screen, 'LEVEL: {}'.format(self.counter.get_level()), WHITE,
                  30, (5, 5))

        show_text(screen,
                  parse_time(self.counter.get_time()),
                  WHITE,
                  30, (width / 2, 5),
                  align_hor='center')
Пример #7
0
    def _render_count(self, surface):
        bw, bh = self.env.scene.get_bound()

        pygame.draw.rect(surface, BLACK, (0, bh/2 - 75, bw, 150))

        state = self.progress % 1.0
        font_size = int(max(80, 280 - 200 * state / 0.3))

        show_text(surface,
                  str(self.number),
                  WHITE,
                  font_size,
                  (int(bw/2), int(bh/2)),
                  align_hor="center",
                  align_ver="center")
Пример #8
0
    def render(self, surface):
        for i in self.options:
            option = self.options[i]
            color = GRAY
            if i == self.selected:
                color = SELECTED_GREEN
            if option["enable"] == False:
                color = WHITE

            x = self.position[0] + (self.size[0] /
                                    (len(self.options) + 1)) * (i + 1)
            y = self.position[1] + (self.size[1] / 2)

            show_text(surface,
                      option["name"],
                      color,
                      40, (x, y),
                      align_hor="center",
                      align_ver="center")
Пример #9
0
    def _render_data(self, surface):
        for i in range(0, min(10, len(self.ranking_data))):
            (_, _, time, name) = self.ranking_data[i]
            x = self.position[0]
            y = self.position[1] + 30 + 50 * i

            show_text(surface, str(i + 1), DATA_GRAY, 30, (x + 30, y))
            show_text(surface, name, DATA_GRAY, 30, (x + 80, y))
            show_text(surface, parse_time(time), DATA_GRAY, 30, (x + 400, y))
Пример #10
0
    def render(self, screen):
        bound = screen.get_size()

        _, th = self.title.get_rect().size
        tw = int(420 * 1.5)
        screen.blit(self.title, ((bound[0] - tw) / 2, 100), (0, 0, tw, th))

        if self.bliping_progress < 0.5:
            show_text(screen,
                      'press SPACE to start',
                      WHITE,
                      40, (bound[0] / 2, 500),
                      align_hor="center")

        show_text(screen, 'Made by', WHITE, 20,
                  (bound[0] - 300, bound[1] - 100))
        show_text(screen, '四資四甲 1103137124 陳銘嘉', WHITE, 20,
                  (bound[0] - 300, bound[1] - 50))
Пример #11
0
    def _render_pause(self, screen):
        (x, y) = self.get_scene().get_bound()

        show_text(screen, "PAUSE", WHITE, 50, (x/2, y/2), align_hor="center", align_ver="center")