#!/usr/bin/perl -w if ($#ARGV < 2) { print "gen-jgame-html - generate HTML for JGame applet\n"; print "\n"; print "usage:\n"; print "\n"; print "gen-jgame-html.pl [java class name] [filesuffix] \n"; print " [field and parameter string]\n"; print " [ list of resolutions ] \n"; print "\n"; print "Resolutions are specified as [xsize]x[ysize].\n"; print "\n"; print "The generator looks for a desc file named [gamename]-desc.txt.\n"; print "\n"; print "It creates files named applet-[classname][filesuffix]-[resolution].html\n"; exit(0); } $classname = shift @ARGV; $filesuffix = shift @ARGV; $customfield = shift @ARGV; @resolutions = @ARGV; push @resolutions, "fullscreen"; $classname =~ /([^.]*)$/; $gamename = $1; $gamename_lc = lc $gamename; $descfile = "$gamename_lc-desc.txt"; open INPUT,"<$descfile"; read(INPUT, $text, 1024000); foreach $res (@resolutions) { if ($res =~ /([0-9]*)x([0-9]*)/) { $resx = $1; $resy = $2; } else { #fullscreen $resx = "100%"; $resy = "100%"; } open OUT, ">applet-$gamename_lc$filesuffix-$res.html"; print OUT "$gamename applet\n"; print OUT "\n"; print OUT "
\n"; print OUT "\n"; print OUT "

\n"; print OUT $text; print OUT "\n"; print OUT "\n"; close OUT; }