Example #1
0
    def draw(self, surface):
        try:
            self.image = pg.image.load("my_sprite0.png").convert_alpha()

        except:
            self.image = None

        prepare.change_cursor("default")
        surface.fill(self.bg_color)
        if self.image == None:
            w, h = surface.get_size()
            self.print_text(surface, (w / 2, h / 2), self.image_load_error, 16, (0, 0, 0))
        else:
            w, h = self.image.get_size()
            self.image0 = pg.transform.scale(self.image, (int(w * 4), int(h * 4)))
            self.image1 = pg.transform.scale(self.image0, (int(w * 2), int(h * 2)))
            self.image2 = pg.transform.scale(self.image1, (int(w), int(h)))
            self.image3 = pg.transform.scale(self.image2, (int(w / 2), int(h / 2)))
            self.image4 = pg.transform.scale(self.image3, (int(w / 4), int(h / 4)))

            surface.blit(self.image0, (0, 0))
            surface.blit(self.image1, (4 * w, 0))
            surface.blit(self.image2, (6 * w, 0))
            surface.blit(self.image3, (7 * w, 0))
            surface.blit(self.image4, (int(7.5 * w), 0))
Example #2
0
    def draw(self, surface):
        surface.blit(prepare.BG_IMAGE, (0, 0))
        self.image = pg.Surface((68, 116), pg.SRCALPHA)

        if self.cursor == 0:
            prepare.change_cursor("default")
        elif self.cursor == 1:
            prepare.change_cursor("hand")
        elif self.cursor == 2:
            prepare.change_cursor("move")

        for cursor_change_bug in ["It is really a weird bug"]:
            self.cursor = 0
        x, y = pg.mouse.get_pos()
        for button in prepare.BUTTON_DICT:
            if prepare.BUTTON_DICT[button].collidepoint(x, y):
                self.cursor = 1
                pg.draw.line(
                    surface,
                    (0, 0, 255),
                    prepare.BUTTON_DICT[button].bottomleft,
                    prepare.BUTTON_DICT[button].bottomright,
                    2,
                )

        for button in prepare.B_DICT:
            if prepare.B_DICT[button].collidepoint(x, y):
                self.cursor = 2
                pg.draw.rect(surface, (0, 0, 255), prepare.B_DICT[button], 2)

        if self.background != None:
            self.image_bg = self.image.copy()
            self.image_bg.fill(self.background)
            surface.blit(self.image_bg, prepare.SPRITE_POS.topleft)
        self.image.blit(self.skin, (0, 0))

        if self.hair != None:
            self.image.blit(self.hair, (0, 0))
        if self.facial_hair != None:
            self.image.blit(self.facial_hair, (0, 0))
        if self.eyes != None:
            self.image.blit(self.eyes, (0, 0))
        if self.hat != None:
            self.image.blit(self.hat, (0, 0))
        if self.mask != None:
            self.image.blit(self.mask, (0, 0))
        if self.tops != None:
            self.image.blit(self.tops, (0, 0))
        if self.bottoms != None:
            self.image.blit(self.bottoms, (0, 0))
        if self.shoes != None:
            self.image.blit(self.shoes, (0, 0))

        surface.blit(self.image, prepare.SPRITE_POS.topleft)
Example #3
0
 def draw(self, surface):
     prepare.change_cursor("default")
     surface.blit(prepare.HELP_IMAGE, (0, 0))