Ejemplo n.º 1
0
    def load_images(self, size=None, permanent=False):
        self.img_indexes = []

        for p in self.path_list:

            path = CONST.path_prefix + self.root_path + p
            files = []
            if ".png" in path:
                files = [path]
            else:
                files = [
                    os.path.join(path, f) for f in listdir(path) if (isfile(join(path, f)) and f.find(".png") != -1)
                ]
            files.sort()
            for f in files:
                self.img_indexes.append(img_manager.load_image(f, permanent))
            try:
                self.img = self.img_indexes[0]
            except IndexError:
                pass
        if size is None:
            self.size = img_manager.get_size(self.img)
        else:
            self.size = Vector2(size)
        if self.obj:
            self.obj.update_rect()
Ejemplo n.º 2
0
 def init_image(self,size=None):
     if self.anim:
         self.anim.load_images(size)
     else:
         self.img = img_manager.load_image(self.path)
         if self.size is None:
             self.size = Vector2(img_manager.get_size(self.img))
         self.rect = Rect(self.pos, self.size)