Skip to content

Commit

Permalink
Don't generate separate image for each tile any more.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasrosdal committed May 25, 2013
1 parent c54f238 commit ff27164
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
13 changes: 1 addition & 12 deletions freeciv-img-extract/img-extract.py
Expand Up @@ -96,7 +96,7 @@ def increment_tileset_image():
global tileset_inc;

draw = ImageDraw.Draw(tileset)
draw.text((130, 0), "Freeciv.net - GPL Licensed - Copyright 2007-2011 Andreas Rosdal", fill="rgb(0,0,0)")
draw.text((130, 0), "Freeciv-web - GPL Licensed - Copyright 2007-2013 Andreas Rosdal", fill="rgb(0,0,0)")

tileset.save("pre-freeciv-web-tileset-" + str(tileset_inc) + ".png");
tileset_inc += 1;
Expand Down Expand Up @@ -135,7 +135,6 @@ def increment_tileset_image():
if (curr_y + h >= tileset_height):
increment_tileset_image();
tileset.paste(im, (curr_x, curr_y));
im.save("tiles/" + rsprite[0] + ".png");
coords[rsprite[0]] = (curr_x, curr_y, w, h, tileset_inc);
curr_x += w;
if (h > max_row_height): max_row_height = h;
Expand Down Expand Up @@ -222,7 +221,6 @@ def increment_tileset_image():
tileset.paste(result_cell, (curr_x, curr_y), mask);
store_img = Image.new('RGBA', (w, h), (0, 0, 0, 0));
store_img.paste(result_cell, (0, 0), mask);
store_img.save("tiles/" + tag + "." + str(dir) + ".png");
coords[tag + "." + str(dir)] = (curr_x, curr_y, w, h, tileset_inc);
curr_x += w;
if (h > max_row_height): max_row_height = h;
Expand All @@ -246,7 +244,6 @@ def increment_tileset_image():
increment_tileset_image();

tileset.paste(result_tile, (curr_x, curr_y));
result_tile.save("tiles/" + tag + ".png");

coords[tag] = (curr_x, curr_y, w, h, tileset_inc);
curr_x += w;
Expand All @@ -260,7 +257,6 @@ def increment_tileset_image():
if (tag2 != None and len(tag2) > 0):
coords[tag2] = (curr_x, curr_y, w, h, tileset_inc);
print("saving tag: " + tag2);
result_tile.save("tiles/" + tag2 + ".png");

if "grid_coasts" in config.sections():
dx = int(config.get("grid_coasts", "dx"));
Expand Down Expand Up @@ -311,7 +307,6 @@ def increment_tileset_image():
increment_tileset_image();

tileset.paste(result_tile, (curr_x, curr_y));
result_tile.save("tiles/" + tag + ".png");

coords[tag] = (curr_x, curr_y, w, h, tileset_inc);
curr_x += w;
Expand All @@ -324,7 +319,6 @@ def increment_tileset_image():
#if (tag2 != None): result_tile.save(tag2 + ".png");
if (tag2 != None):
coords[tag2] = (curr_x, curr_y, w, h, tileset_inc);
result_tile.save("tiles/" + tag + ".png");


# handle dithered tiles.
Expand All @@ -350,7 +344,6 @@ def increment_tileset_image():
if (curr_y + h >= tileset_height):
increment_tileset_image();
tileset.paste(result_cell, (curr_x, curr_y));
result_cell.save("tiles/" + tag + ".png");

coords[tag] = (curr_x, curr_y, w, h, tileset_inc);

Expand Down Expand Up @@ -385,8 +378,4 @@ def increment_tileset_image():
f.write("var tileset = " + json.dumps(coords, separators=(',',':')));


f_sm = open('freeciv-web-tileset-small-preload.html', 'w')
for sp_key in coords:
f_sm.write("<img src='/tiles/" + sp_key + ".png' width='0' height='0'>");

print("done.");
4 changes: 1 addition & 3 deletions freeciv-img-extract/sync.sh
Expand Up @@ -4,6 +4,4 @@ pngcrush pre-freeciv-web-tileset-1.png freeciv-web-tileset-1.png &&
mkdir -p ../freeciv-web/src/main/webapp/tileset &&
cp freeciv-web-tileset-0.png ../freeciv-web/src/main/webapp/tileset/ &&
cp freeciv-web-tileset-1.png ../freeciv-web/src/main/webapp/tileset/ &&
cp freeciv-web-tileset.js ../freeciv-web/src/main/webapp/javascript/ &&
mkdir -p ../freeciv-web/src/main/webapp/tiles &&
cp tiles/*.png ../freeciv-web/src/main/webapp/tiles/
cp freeciv-web-tileset.js ../freeciv-web/src/main/webapp/javascript/

0 comments on commit ff27164

Please sign in to comment.