def __init__(self, rend, inv): entity.__init__(self) if inv: self.texture = sdl2.SDL_CreateTextureFromSurface( rend, IMG_Load(pipe_path_inv)) self.surface = sdl2.SDL_Rect(pipeBaseX, -175, pipeWidth, pipeHeight) else: self.texture = sdl2.SDL_CreateTextureFromSurface( rend, IMG_Load(pipe_path)) self.surface = sdl2.SDL_Rect(pipeBaseX, 275, pipeWidth, pipeHeight)
def __init__(self, rend): entity.__init__(self) self.texture = [sdl2.SDL_CreateTextureFromSurface(rend, IMG_Load(img0)), sdl2.SDL_CreateTextureFromSurface(rend, IMG_Load(blank)), sdl2.SDL_CreateTextureFromSurface(rend, IMG_Load(blank))] self.isScore = True self.surface0 = sdl2.SDL_Rect(300, 25, 97-70, 129-80) self.surface1 = sdl2.SDL_Rect(300 - 40, 25, 97-70, 129-80) self.surface2 = sdl2.SDL_Rect(300 - (2 * 40), 25, 97-70, 129-80) self.count = 0 self.rend = rend self.update_textures()
def __init__(self, path, center=None, scale=2.0): self.surface = IMG_Load(path.encode("utf-8")) self.w = self.surface.contents.w self.h = self.surface.contents.h self.center = Rect(*center) if center else Rect(self.w, self.h) self.scale = scale self.texture_cache = {} self.slice_rects = self.get_slices()
def load_surface(self): if self._surface is None: if self.path: self._surface = IMG_Load(self.path.encode("utf-8")) else: self._surface = IMG_Load_RW(self.rw, 0) self._size = Size(self._surface.contents.w, self._surface.contents.h)
def __init__(self, rend): entity.__init__(self) self.texture = sdl2.SDL_CreateTextureFromSurface( rend, IMG_Load(image_path)) self.surface = sdl2.SDL_Rect(80, 270, birdWidth, birdHeight) self.acc = 7.0 self.vel = 0.0 pass
def __init__(self, rend): entity.__init__(self) self.texture = sdl2.SDL_CreateTextureFromSurface( rend, IMG_Load(title_img)) self.surface = sdl2.SDL_Rect(120, 50, 370, 133) self.Running = False
def update_textures(self): if self.count % 10 == 0: self.texture[0] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img0)) elif self.count % 10 == 1: self.texture[0] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img1)) elif self.count % 10 == 2: self.texture[0] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img2)) elif self.count % 10 == 3: self.texture[0] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img3)) elif self.count % 10 == 4: self.texture[0] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img4)) elif self.count % 10 == 5: self.texture[0] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img5)) elif self.count % 10 == 6: self.texture[0] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img6)) elif self.count % 10 == 7: self.texture[0] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img7)) elif self.count % 10 == 8: self.texture[0] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img8)) elif self.count % 10 == 9: self.texture[0] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img9)) if self.count / 10 == 0: self.texture[1] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(blank)) elif self.count / 10 == 1: self.texture[1] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img1)) elif self.count / 10 == 2: self.texture[1] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img2)) elif self.count / 10 == 3: self.texture[1] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img3)) elif self.count / 10 == 4: self.texture[1] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img4)) elif self.count / 10 == 5: self.texture[1] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img5)) elif self.count / 10 == 6: self.texture[1] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img6)) elif self.count / 10 == 7: self.texture[1] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img7)) elif self.count / 10 == 8: self.texture[1] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img8)) elif self.count / 10 == 9: self.texture[1] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img9)) if self.count / 100 == 0: self.texture[2] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(blank)) elif self.count / 100 == 1: self.texture[2] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img1)) elif self.count / 100 == 2: self.texture[2] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img2)) elif self.count / 100 == 3: self.texture[2] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img3)) elif self.count / 100 == 4: self.texture[2] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img4)) elif self.count / 100 == 5: self.texture[2] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img5)) elif self.count / 100 == 6: self.texture[2] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img6)) elif self.count / 100 == 7: self.texture[2] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img7)) elif self.count / 100 == 8: self.texture[2] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img8)) elif self.count / 100 == 9: self.texture[2] = sdl2.SDL_CreateTextureFromSurface(self.rend, IMG_Load(img9))
def loadImage(self, file_path): if file_path not in self._sprite_sheets.keys(): self._sprite_sheets[file_path] = IMG_Load(file_path) return self._sprite_sheets[file_path]
def __init__(self, rend): entity.__init__(self) self.texture = sdl2.SDL_CreateTextureFromSurface(rend, IMG_Load(floor_img)) self.surface = sdl2.SDL_Rect(0, 490, 1200, 150) pass
def __init__(self, rend): entity.__init__(self) self.texture = sdl2.SDL_CreateTextureFromSurface( rend, IMG_Load(background_img)) self.surface = sdl2.SDL_Rect(0, 0, 1575, 500) pass