Mercurial > touhou
comparison pytouhou/opengl/texture.py @ 83:fc0294c745b6
Basic bullet handling! Clean up as soon as possible :p
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sat, 03 Sep 2011 22:22:58 +0200 |
parents | ab826bc29aa2 |
children | ac2e5e1c2c3c |
comparison
equal
deleted
inserted
replaced
82:de48213a02bf | 83:fc0294c745b6 |
---|---|
21 from OpenGL.GL import * | 21 from OpenGL.GL import * |
22 from OpenGL.GLU import * | 22 from OpenGL.GLU import * |
23 | 23 |
24 | 24 |
25 class TextureManager(object): | 25 class TextureManager(object): |
26 def __init__(self, archive): | 26 def __init__(self, archive=None): |
27 self.archive = archive | 27 self.archive = archive |
28 self.textures = {} | 28 self.textures = {} |
29 | 29 |
30 def __getitem__(self, key): | 30 def __getitem__(self, key): |
31 if not key in self.textures: | 31 if not key in self.textures: |
32 self.textures[key] = self.load_texture(key) | 32 self.textures[key] = self.load_texture(key) |
33 return self.textures[key] | 33 return self.textures[key] |
34 | 34 |
35 | 35 |
36 def preload(self, anms): | 36 def preload(self, anm_wrapper): |
37 try: | |
38 anms = anm_wrapper.anm_files | |
39 except AttributeError: | |
40 anms = anm_wrapper | |
41 | |
37 for anm in anms: | 42 for anm in anms: |
38 key = anm.first_name, anm.secondary_name | 43 key = anm.first_name, anm.secondary_name |
39 texture = self[key] | 44 texture = self[key] |
40 | 45 |
41 | 46 |