#!/usr/bin/perl
use lib '.';
require "pagelib.pl";
header();
head();

$dir = "images/xwing";
if(!opendir(DIR,$dir)) {
    print "Internal error locating images!<br>\n";
}
@files = readdir(DIR);
foreach(@files) { push @images,$1 if(/(xwing\d+)\.jpg/); }

%used = ();

print qq`
<br><br>What started one night as a test to see how big an X-Wing \'should\' be
turned into an attempt to get a nice version of a minifig-scale X-Wing fighter.<br><br>
`;

show_images(
	    'xwing01',
	    'xwing03',
	    'xwing04',
	    'xwing05',
	    'xwing06',
	    'xwing07',
	    'xwing10',
	    'xwing13',
	    'xwing14',
	    'xwing17',
	    'xwing18',
	    'xwing34',
	    'xwing25',
	    );

print qq`
<br><br>One thing that mildly bothered me about the Lego model of the X-Wing is
that when extended, the wings have no \"gap\" between them where they meet the body.<br><br>
`;
show_images(
	    'xwing22',
	    'xwing23',
	    'xwing24',
	    );
print qq`
<br><br>In the real production models for Star Wars, a small gap is seen between
the wings when they open, since \(apparently\) opposite wings are attached to a
central pivot point inside the body. Hence, I duplicated this in my model-- so moving
one wing will move its opposing counterpart.<br><br>
`;
show_images(
	    'xwing21',
	    'xwing19',
	    'xwing20',
	    );
print qq`
<br><br>Another disappointment with the Lego model \(more disappointing in the UCS
version, since presumably they had a bigger budget to go on\) was the lack of landing
gear. Although I\'m still not pleased with the rear landing gear, I put in some
semblance of it:<br><br>
`;
show_images(
	    'xwing09',
	    'xwing08',
	    'xwing26',
	    'xwing27',
	    'xwing28',
	    'xwing29',
	    'xwing30',
	    'xwing31',
	    'xwing32',
	    'xwing33',
	    );


#show_images(@images);
foot();

sub show_images {
    my(@pics) = @_;
    my($i) = 0;
    print "<table width=100\%><tr>\n";
    foreach(@pics) {
	next if($used{$_});
	$used{$_} = 1;
	if(!($i++%4)) {
	    print "</tr>\n<tr>\n";
	}
	print "<td align=center><a href=\"$dir/$_.jpg\"><img src=\"$dir/$_\_th.jpg\" border=0></a></td>\n";
    }
    print "</tr></table>\n";
}
