Python 3.x 更改雪碧派格莱特的批次
如何在pyglet中更改精灵的批处理对象Python 3.x 更改雪碧派格莱特的批次,python-3.x,pyglet,Python 3.x,Pyglet,如何在pyglet中更改精灵的批处理对象 def createSprite(obj, batch, layer): img = pyglet.resource.image(obj.path) img.width = obj.w img.height = obj.h return pyglet.sprite.Sprite(img, x=obj.x, y=obj.y, batch=batch, group=layer) 非常模糊的问题。。。但是,好的主题 在pygl
def createSprite(obj, batch, layer):
img = pyglet.resource.image(obj.path)
img.width = obj.w
img.height = obj.h
return pyglet.sprite.Sprite(img, x=obj.x, y=obj.y, batch=batch, group=layer)
非常模糊的问题。。。但是,好的主题 在pyglet中,
sprite
对象有一个名为batch
的属性,可以在执行时更改该属性。非常简单,假设x
是Sprite类的对象,那么:
x.batch = pyglet.graphics.Batch()