当前位置: 首页>>代码示例>>Python>>正文


Python resource.image函数代码示例

本文整理汇总了Python中pyglet.resource.image函数的典型用法代码示例。如果您正苦于以下问题:Python image函数的具体用法?Python image怎么用?Python image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了image函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

	def __init__(self,x,y):
		self.x = x
		self.y = y
		self.mode = '_'
		self.texes = [resource.image("MC/"+fn+".png") for fn in "idle;back;back1;back2;front;front1;front2;run1;run2;run3".split(';')] \
				+ [resource.image("MC/"+fn+".png",flip_x=True) for fn in "run1;run2;run3".split(";")]
		for _ in  self.texes:
			_.anchor_x = _.width//2
			_.anchor_y = _.height//2
		self.texes = [[self.texes[0]],self.texes[1:4],self.texes[4:7],self.texes[7:10],self.texes[10:]]
		self.texnum = 0.0
开发者ID:ZakkkkAttackkkk,项目名称:hackathon2k15,代码行数:11,代码来源:main.py

示例2: __init__

    def __init__(self, x, y, img_fname, flip_x=False, color=None, opacity=None, batch=None):
        if flip_x:
            super(Item, self).__init__(img=resource.image(name=img_fname, flip_x=True), x=SPRITE_WIDTH*(x+1), y=SPRITE_HEIGHT*y, batch=batch)
        else:
            super(Item, self).__init__(img=resource.image(name=img_fname), x=SPRITE_WIDTH*x, y=SPRITE_HEIGHT*y, batch=batch)

        if color is not None:
            self.color = color

        if opacity is not None:
            self.opacity = opacity

        self._x_units, self._y_units = x, y
开发者ID:varnie,项目名称:snake,代码行数:13,代码来源:Item.py

示例3: grabFrame

	def grabFrame(self):
		"""
		this version of grab frame asumes the timing information is in the clip xml node and extrapolates image number based on time
		"""
		#this version does not allow for "freezing" on last frame and requires looping otherwise returns None -> nothing is drawn
		#todo implement freezing, this should be a either a CLIP property or a GRAPHNODE property that overrides whatever the CLIP property is
		n = self.grabFrameNumber()
		if int(n) <= int(self.xml.getAttribute("frames"))-1:
			#print stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+".jpg")
			return resource.image(stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+".png"))
		#return the last frame in the clip if we specify freeze = True
		if self.freeze:
			n = str(int(self.xml.getAttribute("frames"))-1)
			return resource.image(stupid.splitjoin(self.xml.getAttribute("folder")+self.xml.getAttribute("prefix")+n.zfill(5)+".png"))
		return None
开发者ID:chippermonky,项目名称:roulette,代码行数:15,代码来源:clip.py

示例4: load

	def load(self):
		self.batch = graphics.Batch()
		self.background = graphics.OrderedGroup(0)
		self.stars = Stars(Size(2000, 2000), self.batch, self.background)
		centre = Vector(self.size.width/2, self.size.height/2)
		image = centre_image(resource.image("win.png"))
		self.logo = sprite.Sprite(image, centre.x, centre.y)
开发者ID:Lattyware,项目名称:asteroidbelt,代码行数:7,代码来源:scenes.py

示例5: __init__

    def __init__(self, client, points=9, eye=1, wait=1, randomize=1, auto=0, speed=1, level=3):
        super(CalibrationLayer, self).__init__(0, 0, 255, 255)
        self.client = client
        self.points = points
        self.eye = eye
        self.wait = wait
        self.randomize = randomize
        self.auto = auto
        self.speed = speed
        self.level = level
        self.on_success = None
        self.on_failure = None

        self.window = director.window.get_size()
        self.screen = director.get_window_size()
        self.center_x = self.screen[0] / 2
        self.center_y = self.screen[1] / 2
        self.win_scale = (self.screen[0] / self.window[0], self.screen[1] / self.window[1])

        self.font = font.load("Cut Outs for 3D FX", 32)
        self.circle_img = self.font.get_glyphs("E")[0].get_texture(True)
        self.circle_img.anchor_x = "center"
        self.circle_img.anchor_y = "center"
        self.pnt_img = self.font.get_glyphs("Y")[0].get_texture(True)
        self.pnt_img.anchor_x = "center"
        self.pnt_img.anchor_y = "center"

        self.circle = Sprite(self.circle_img, color=(255, 255, 0), scale=1, opacity=0)
        self.spinner = Sprite(
            resource.image("spinner.png"), position=(self.screen[0] / 2, self.screen[1] / 2), color=(255, 255, 255)
        )
开发者ID:CogWorks,项目名称:WhackAMole,代码行数:31,代码来源:calibrator.py

示例6: __init__

    def __init__(self, *args, image=image('assets/blue_box.png'), **kwargs):
        super().__init__(image, **kwargs)
        self.__dict__.update(kwargs)
        self.aim_cursor = AimCursor(mouse_angle=0.00, player_x=self.cx, player_y=self.cy)

        # Setup Player Movement
        self.max_velocity = 10
        self.vel_x = 0
        self.vel_y = 0
        self.acceleration = 2
        self.quad_coefficient = 0.15
        self.animation_time = 5
        self.is_jumping = False
        self.is_falling = False
        self.quadrant_setup = False

        # Setup Mouse
        self.mouse_angle = 0
        self.mouse_dx = 0
        self.mouse_dy = 0
        self.mouse_velocity = 4

        # Setup Physics
        self.gravity = 5
        self.mass = 5
        self.terminal_velocity = self.max_velocity * self.gravity
        self.max_jumps = 2
        self.jumps = 0


        self.keys_pressed = {}
开发者ID:jaitaiwan,项目名称:idabb,代码行数:31,代码来源:player.py

示例7: get_texture

 def get_texture(fname):
     cache = ImageCache.cache
     tex = cache.get(fname, None)
     if not tex:
         tex = resource.image(fname).texture
         ImageCache.cache[fname] = tex
     return tex
开发者ID:Incantus,项目名称:incantus,代码行数:7,代码来源:resources.py

示例8: _load

 def _load(filename, key, anchor=False):
     cache = ImageCache.cache
     value = resource.image(filename)
     if anchor:
         value.anchor_x = value.width / 2
         value.anchor_y = value.height / 2
     cache[key] = value
开发者ID:Incantus,项目名称:incantus,代码行数:7,代码来源:resources.py

示例9: _load_multi

 def _load_multi(filename, labels, rows, columns, anchor=False):
     cache = ImageCache.cache
     multiimage = image.ImageGrid(resource.image(filename), rows, columns)
     for key, texture in zip(labels, multiimage):
         if anchor:
             texture.anchor_x = texture.width / 2
             texture.anchor_y = texture.height / 2
         cache[key] = texture
开发者ID:Incantus,项目名称:incantus,代码行数:8,代码来源:resources.py

示例10: load_sprite_animation

def load_sprite_animation(name, action, frames=8, duration=0.1):
    " Creates an animation from files in the assets folder "
    images = [resource.image("assets/%s/%s%d.png" % (name, action, i))
                for i in range(1, frames + 1)]
    for image in images:
        image.anchor_x = image.width / 2
    frames = [AnimationFrame(i, duration) for i in images]
    return Animation(frames)
开发者ID:johnmendel,项目名称:python-tactics,代码行数:8,代码来源:util.py

示例11: load

    def load(self):
        resource.path = ["data"]
        resource.reindex()
        numbers = resource.image("numbers.png")

        self.numbers = {}
        width = numbers.width / 10
        for n in xrange(0, 10):
            self.numbers[n] = numbers.get_region(n * width, 0, width, numbers.height)
开发者ID:tartley,项目名称:pyong,代码行数:9,代码来源:bitmaps.py

示例12: _load_images

    def _load_images(self, tiles):
        self.tile_images = []
        for path, solid in tiles:
            image = resource.image(path)
            image.solid = solid
            self.tile_images.append(image)

        self.tile_width = max(image.width for image in self.tile_images)
        self.tile_height = max(image.height for image in self.tile_images)
开发者ID:ceronman,项目名称:prisionescape,代码行数:9,代码来源:tilemap.py

示例13: __init__

    def __init__(self):
        self.x = 850
        self.y = 550
        self.img = resource.image('sun.png')
        self.img.anchor_x = self.img.width / 2
        self.img.anchor_y = self.img.height / 2
        self.rotation = 0

        pyglet.clock.schedule(self.update)
开发者ID:pdevine,项目名称:happytown-python,代码行数:9,代码来源:title.py

示例14: populated

	def populated(self, populated):
		if not populated == self._populated:
			self._populated = populated
			if populated:
				name = self.type
			else:
				name = "raw_"+self.type
			self.sprite.image = centre_image(resource.image(name+".png"))
			if self.type == "home": #HACK
				self.sprite.visible = True
开发者ID:Lattyware,项目名称:asteroidbelt,代码行数:10,代码来源:entities.py

示例15: __init__

    def __init__(self, path):
        """
        Takes the :param:`path` , verifies its dimensions and sets it as texture.

        :param path: The path of the image
        """
        self.image_name = path.split('/')[-1]
        self.image = resource.image(self.image_name).texture
        self.verify_dimensions()
        glGenerateMipmap(self.image.target)
开发者ID:sgeyer-tgm,项目名称:SolarSystem,代码行数:10,代码来源:texture.py


注:本文中的pyglet.resource.image函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。