diff options
Diffstat (limited to 'txtgameengine')
-rw-r--r-- | txtgameengine/twod/textures.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/txtgameengine/twod/textures.py b/txtgameengine/twod/textures.py index 0451e5c..796774e 100644 --- a/txtgameengine/twod/textures.py +++ b/txtgameengine/twod/textures.py @@ -12,16 +12,14 @@ class Texture: def __init__(self, app: 'TxtGameApp', path: str): self.app = app self.path = path - self._load_from_disk() self._bind_to_gl() - def _load_from_disk(self): - self.image = Image.open(TEXTURE_FOLDER + self.path) - self.width, self.height = self.image.size - def _bind_to_gl(self): - imagedata = np.array(list(self.image.getdata()), np.uint8) + image = Image.open(TEXTURE_FOLDER + self.path) + self.width, self.height = image.size + imagedata = np.array(list(image.getdata()), np.uint8) self.gl_texid = self.app.render.setup_texture(self.width, self.height, imagedata) + image.close() def free(self): self.app.render.free_texture(self.gl_texid)
\ No newline at end of file |