mirror of
https://github.com/quantum5/punyverse.git
synced 2025-04-24 13:11:57 -04:00
Image shrinker now reads a list of files to resize, instead of using a hard coded list. This now doesn't need the launcher to be rebuilt for every new texture.
This commit is contained in:
parent
4f4ec651c1
commit
67c6becca3
20
punyverse/assets/textures.txt
Normal file
20
punyverse/assets/textures.txt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# This file contains all the textures that is bigger than the minimum OpenGL texture size
|
||||||
|
# and hence may need to be resized depending on the machine
|
||||||
|
|
||||||
|
mercury.jpg
|
||||||
|
earth.jpg
|
||||||
|
moon.jpg
|
||||||
|
mars.jpg
|
||||||
|
jupiter.jpg
|
||||||
|
saturn.jpg
|
||||||
|
moons/io.jpg
|
||||||
|
moons/europa.jpg
|
||||||
|
moons/ganymede.jpg
|
||||||
|
moons/callisto.jpg
|
||||||
|
moons/titan.jpg
|
||||||
|
moons/rhea.jpg
|
||||||
|
moons/iapetus.jpg
|
||||||
|
moons/dione.jpg
|
||||||
|
moons/tethys.jpg
|
||||||
|
moons/enceladus.jpg
|
||||||
|
moons/mimas.jpg
|
|
@ -109,11 +109,20 @@ def get_main_dir():
|
||||||
return os.path.dirname(__file__)
|
return os.path.dirname(__file__)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
texture = os.path.join(get_main_dir(), 'punyverse', 'assets', 'textures')
|
punyverse = os.path.join(get_main_dir(), 'punyverse')
|
||||||
for file in textures:
|
try:
|
||||||
|
with open(os.path.join(punyverse, 'assets', 'textures.txt')) as f:
|
||||||
|
files = [i.strip() for i in f if not i.startswith('#') and i.strip()]
|
||||||
|
except IOError:
|
||||||
|
files = textures
|
||||||
|
texture = os.path.join(punyverse, 'assets', 'textures')
|
||||||
|
for file in files:
|
||||||
print 'Resizing %s:' % file,
|
print 'Resizing %s:' % file,
|
||||||
file = os.path.join(texture, file.replace('/', os.sep))
|
file = os.path.join(texture, file.replace('/', os.sep))
|
||||||
|
if os.path.exists(file):
|
||||||
shrink(file)
|
shrink(file)
|
||||||
|
else:
|
||||||
|
print 'exists not'
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue