Beispiel #1
0
 def draw(self, x: int, y: int, center=True) -> None:
     if center:
         Text.draw(
             self.text,
             centerx=x,
             top=y,
             size=self.size,
             color=self.color,
             alpha=self.alpha,
             shadow=(2.0, 2.0),
             scolor=self.scolor,
             gcolor=self.gcolor,
             lineheight=2,
         )
     else:
         Text.draw(
             self.text,
             left=x,
             top=y,
             size=self.size,
             color=self.color,
             alpha=self.alpha,
             shadow=(2.0, 2.0),
             scolor=self.scolor,
             gcolor=self.gcolor,
             lineheight=2,
         )
    def draw(self, x: int, y: int, draw_piece=True) -> None:
        self.matrix.draw(x, y)

        if draw_piece and self.piece:
            self.matrix.get_ghost(self.piece).draw(x, y)
            self.piece.draw(x, y)

        self.score.draw(x, y - 70)
        self.bag.draw(x + 340, y + 70)

        if self.holder is not None:
            holder_x = int(x - 65 - self.holder.shape.get_width(0) * 11.25)
            self.holder.shape.draw(0, holder_x, y + 60, 22, 1.0)
        else:
            shape.SHAPE_HOLD_NONE.draw(0, x - 85, y + 60, 22, 1.0)

        Text.draw("Hold", centerx=x - 75, top=y + 20)
        Text.draw("Next", centerx=x + 370, top=y + 20)
Beispiel #3
0
 def draw(self) -> None:
     if self.players == 1:
         if self.done_players == 0:
             Text.draw(
                 "Press any button",
                 size=5,
                 gcolor="red",
                 centery=350,
                 centerx=650,
             )
     elif self.done_players == 0:
         Text.draw(
             "Player 1 press any button",
             size=5,
             gcolor="green",
             centery=350,
             centerx=650,
         )
     elif self.done_players == 1 and self.players == 2:
         Text.draw(
             "Player 2 press any button",
             size=5,
             gcolor="cyan",
             centery=350,
             centerx=650,
         )
    def draw(self) -> None:
        self.gameplay1.draw(130, 80)
        self.gameplay2.draw(880, 80, draw_piece=not self.waiting)

        if self.waiting:
            Text.draw("Awaiting", size=4, centerx=880 + 155, top=220)
            Text.draw("opponent",
                      size=4,
                      gcolor="red",
                      centerx=880 + 155,
                      top=280)

            string = "." * self.waiting_cycle

            Text.draw(string,
                      size=8,
                      gcolor="black",
                      centerx=880 + 155,
                      top=350)

            if ctx.now - self.last_waiting_cycle > 0.5:
                self.last_waiting_cycle = ctx.now
                self.waiting_cycle = (self.waiting_cycle + 1) % 4

        if self.current_popup1:
            self.current_popup1.draw(130 + 155, 80 + 220)

        if self.current_popup2:
            self.current_popup2.draw(880 + 155, 80 + 220)
Beispiel #5
0
    def draw(self) -> None:
        Text.draw("Tetris", centerx=640, top=30, size=10)

        Text.draw("Duel",
                  centerx=650,
                  top=130,
                  size=8,
                  color="red",
                  gcolor="yellow")

        colors = ["white" for _ in range(self.max_position + 1)]
        colors[self.position] = "gold"

        Text.draw("Marathon", centerx=650, top=300, color=colors[0])
        Text.draw("Split Screen", centerx=650, top=350, color=colors[1])
        Text.draw("Duel Online", centerx=650, top=400, color=colors[2])
        Text.draw("Quit", centerx=650, top=450, color=colors[3])

        x = 460
        y = 305 + self.position * 50
        Text.draw("\u2192", (x, y), color="gold", size=2)