The code below is giving me the following error. It's just a static
sprite that I scroll an image across. It works fine when drawn by
itself, but when I include it in a batch the 'wrong type' error pops
up. Any ideas?
File "C:\Python26\lib\site-packages\pyglet\sprite.py", line 143, in
set_state
glBlendFunc(self.blend_src, self.blend_dest)
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: wrong
type
#####My code:######
asteroid_belt_batch = pyglet.graphics.Batch()
class Level_1(pyglet.sprite.Sprite):
def __init__(self, img, x, y, batch):
super(Level_1, self).__init__(img, x, y, batch)
self.x = 0
self.y = Window_Height / 2
self.img = img
self.gx = x
self.gy = y
self.batch = batch
def update(self, dt):
self.dx = 40 / (space_quotient * 5)
self.x -= self.dx * dt
def draw(self):
glMatrixMode(GL_TEXTURE)
glPushMatrix()
glTranslatef(self.x, self.y, -100.0)
self.img.blit(self.gx, self.gy, 0)
glPopMatrix()
glMatrixMode(GL_MODELVIEW)
asteroid_level_1_texture =
pyglet.resource.image('small_asteroids.png')
asteroid_level_1 = Level_1(asteroid_level_1_texture, batch =
asteroid_belt_batch, x = 0, y = (Window_Height / 2) - 256)
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en.