c2ephp
|
00001 <?php 00002 require_once(dirname(__FILE__).'/../support/FileReader.php'); 00003 require_once(dirname(__FILE__).'/../sprites/S16File.php'); 00004 require_once(dirname(__FILE__).'/../sprites/C16File.php'); 00005 require_once(dirname(__FILE__).'/../sprites/SPRFile.php'); 00006 00007 $extension = substr(strtolower($argv[1]),-4); 00008 $file; 00009 switch($extension) { 00010 case '.s16': 00011 $file = new S16File(new FileReader($argv[1])); 00012 break; 00013 case '.c16': 00014 $file = new C16File(new FileReader($argv[1])); 00015 break; 00016 case '.spr': 00017 $file = new SPRFile(new FileReader($argv[1])); 00018 break; 00019 } 00020 print_r($file); 00021 mkdir(dirname(__FILE__).'/'.substr($argv[1],0,-4)); 00022 $count = $file->GetFrameCount(); 00023 print $count . " files to write.\n"; 00024 for($i=0;$i<$count;$i++) { 00025 $fh = fopen(substr($argv[1],0,-4).'/'.substr($argv[1],0,-4).'-'.$i.'.png','wb'); 00026 fwrite($fh,$file->ToPNG($i)); 00027 fclose($fh); 00028 print '.'; 00029 } 00030 print "\nCompleted.\n"; 00031 00032 ?>