Changeset 9007 for lang/java/NanikaKit
- Timestamp:
- 04/06/08 17:44:30 (5 years ago)
- Location:
- lang/java/NanikaKit/trunk
- Files:
-
- 2 added
- 1 removed
- 10 modified
-
build.xml (modified) (4 diffs)
-
src/com/mac/tarchan/image/ChromakeyImageFilter.java (modified) (1 diff)
-
src/com/mac/tarchan/image/ChromakeyOp.java (modified) (1 diff)
-
src/com/mac/tarchan/nanika/SakuraBalloon.java (added)
-
src/com/mac/tarchan/nanika/SakuraGhost.java (modified) (14 diffs)
-
src/com/mac/tarchan/nanika/SakuraScript.java (modified) (2 diffs)
-
src/com/mac/tarchan/nanika/SakuraShell.java (modified) (9 diffs)
-
src/com/mac/tarchan/nanika/SakuraShiori.java (added)
-
src/com/mac/tarchan/nanika/SakuraSurface.java (modified) (3 diffs)
-
src/com/mac/tarchan/nanika/nar/NanikaArchive.java (modified) (10 diffs)
-
src/com/mac/tarchan/nanika/nar/NanikaEntry.java (modified) (1 diff)
-
src/test/com/mac/tarchan/nanika/NanikaMini.java (modified) (10 diffs)
-
src/test/com/mac/tarchan/nanika/NanikaTest.java (deleted)
Legend:
- Unmodified
- Added
- Removed
-
lang/java/NanikaKit/trunk/build.xml
r8673 r9007 9 9 <property name="build.bin" value="bin" /> 10 10 <property name="build.lib" value="lib" /> 11 <property name="build.rsrc" value="rsrc" /> 11 12 <property name="build.jar" value="${manifest.title}.jar" /> 12 13 <property name="java.home" value="${env.JAVA_HOME}" /> … … 15 16 <path id="build.class.path"> 16 17 </path> 18 19 <target name="clean"> 20 <delete dir="${build.bin}" /> 21 <delete file="${build.jar}" /> 22 </target> 23 24 <target name="compile"> 25 <mkdir dir="${build.bin}" /> 26 <javac srcdir="${build.src}" destdir="${build.bin}" encoding="UTF-8"> 27 <classpath refid="build.class.path" /> 28 </javac> 29 <copy todir="${build.bin}" overwrite="true"> 30 <fileset dir="${build.rsrc}"> 31 <include name="**/*.properties"/> 32 </fileset> 33 </copy> 34 </target> 17 35 18 36 <target name="jar" depends="compile"> … … 28 46 </manifest> 29 47 </jar> 30 </target> 31 32 <target name="compile"> 33 <mkdir dir="${build.bin}" /> 34 <javac srcdir="${build.src}" destdir="${build.bin}" encoding="UTF-8"> 35 <classpath refid="build.class.path" /> 36 </javac> 37 <copy todir="${build.bin}" overwrite="true"> 38 <fileset dir="${build.src}"> 48 <copy todir="." overwrite="true"> 49 <fileset dir="${build.rsrc}"> 39 50 <include name="**/*.properties"/> 40 51 </fileset> 41 52 </copy> 53 </target> 54 55 <target name="app" depends="jar"> 42 56 </target> 43 57 … … 53 67 </target> 54 68 55 <target name="clean">56 <delete dir="${build.bin}" />57 <delete file="${build.jar}" />58 </target>59 60 69 <target name="download.jars"> 61 70 <mkdir dir="lib" /> -
lang/java/NanikaKit/trunk/src/com/mac/tarchan/image/ChromakeyImageFilter.java
r8673 r9007 13 13 * このクラスは、クロマキー合成を実行します。 14 14 * 15 * @ version1.015 * @since 1.0 16 16 * @author tarchan 17 17 */ -
lang/java/NanikaKit/trunk/src/com/mac/tarchan/image/ChromakeyOp.java
r8673 r9007 13 13 * このクラスは、クロマキー合成を実行します。 14 14 * 15 * @ version1.015 * @since 1.0 16 16 * @author tarchan 17 17 */ -
lang/java/NanikaKit/trunk/src/com/mac/tarchan/nanika/SakuraGhost.java
r8673 r9007 22 22 23 23 /** 24 * このクラスは、ゴーストを 表すために使用します。24 * このクラスは、ゴーストを実装します。 25 25 * 26 * @ version1.026 * @since 1.0 27 27 * @author tarchan 28 28 */ … … 36 36 37 37 /** シェル */ 38 private LinkedHashMap< String, SakuraShell> shell = new LinkedHashMap<String, SakuraShell>();38 private LinkedHashMap<Integer, SakuraShell> shell = new LinkedHashMap<Integer, SakuraShell>(); 39 39 40 40 /** NAR ファイル */ … … 42 42 43 43 /** 現在のシェル */ 44 private String currentShell = "0"; 44 private SakuraShell currentShell; 45 46 /** ゴーストの栞 */ 47 private SakuraShiori shiori; 45 48 46 49 /** … … 48 51 * 49 52 * @param name NAR ファイル名 53 * @return このゴーストへの参照 50 54 * @throws IOException インストール中にエラーが発生した場合 51 55 */ 52 public voidinstall(String name) throws IOException56 public SakuraGhost install(String name) throws IOException 53 57 { 54 58 NanikaArchive newNar = new NanikaArchive(name); … … 58 62 Properties props = nar.get(name).getProperties(); 59 63 log.debug("props=" + props); 64 65 return this; 60 66 } 61 67 62 68 /** 63 69 * ゴーストの姿を現します。 64 */ 65 public void materialize() 66 { 70 * 71 * @return このゴーストへの参照 72 */ 73 public SakuraGhost materialize() 74 { 75 // loading 67 76 log.info("starting up engine"); 68 77 loadShiori(); … … 70 79 loadGhost(); 71 80 loadShell(); 81 82 // materialize 83 setScope(0); 84 setSurface(0); 85 setBalloonSurface(0); 86 setScope(1); 87 setSurface(10); 88 setBalloonSurface(0); 72 89 log.info("materialized"); 90 91 return this; 73 92 } 74 93 … … 81 100 String shioriSubsystem = System.getProperty("com.mac.tarchan.nanika.shiori.dll", "DummyShiori"); 82 101 log.debug("SHIORI=" + shioriSubsystem); 102 103 shiori = new SakuraShiori(); 104 shiori.getTalk(); 83 105 } 84 106 … … 88 110 private void loadBalloon() 89 111 { 112 currentNar.getBalloon(); 90 113 String name="name"; 91 114 String craftman = "craftman"; … … 106 129 private void loadShell() 107 130 { 108 int num = 0; 109 int max = currentNar.list("").length; 110 log.info(String.format("loading surface %d/%d", num, max)); 111 112 String name="name"; 113 String craftman = "craftman"; 114 log.info(String.format("loading SHELL elements named as \"%s\" crafted by %s", name, craftman)); 131 SakuraShell sakura = new SakuraShell("sakura", currentNar); 132 SakuraShell kero = new SakuraShell("kero", sakura); 133 134 // File shellHome = currentNar.getShellHome(); 135 // NanikaEntry[] png = currentNar.list(new File(shellHome, "surface.+\\.png").getPath()); 136 // NanikaEntry[] txt = currentNar.list(new File(shellHome, "surface.+\\.txt").getPath()); 137 // int num = png.length; 138 // int max = txt.length; 139 log.info(String.format("loading surface %d", sakura.getSurfaceCount())); 140 141 String id = sakura.getId(); 142 String craftman = sakura.getCraftman(); 143 log.info(String.format("loading SHELL elements named as \"%s\" crafted by \"%s\"", id, craftman)); 115 144 116 145 // log.debug("currentNar=" + currentNar); … … 118 147 119 148 // sakura 120 shell.put( "0", new SakuraShell("sakura", currentNar));121 shell.get("0").setSurface("0");149 shell.put(0, sakura); 150 // shell.get(0).setSurface(0); 122 151 123 152 // kero 124 shell.put( "1", new SakuraShell("kero", currentNar));125 shell.get("1").setSurface("10");153 shell.put(1, kero); 154 // shell.get(1).setSurface(10); 126 155 } 127 156 128 157 /** 129 158 * ゴーストの姿を消します。 130 */ 131 public void vanish() 159 * 160 * @return このゴーストへの参照 161 */ 162 public SakuraGhost vanish() 132 163 { 133 164 log.info("vanish"); … … 136 167 currentNar = null; 137 168 currentShell = null; 169 170 return this; 171 } 172 173 /** 174 * スコープを変更します。 175 * 176 * @param scope スコープ番号 177 * @return このゴーストへの参照 178 */ 179 public SakuraGhost setScope(int scope) 180 { 181 currentShell = shell.get(scope); 182 183 return this; 184 } 185 186 /** 187 * 現在のスコープのサーフェスを変更します。 188 * 189 * @param id サーフェス ID 190 * @return このゴーストへの参照 191 */ 192 public SakuraGhost setSurface(int id) 193 { 194 if (currentShell != null) currentShell.setSurface(id); 195 196 return this; 197 } 198 199 /** 200 * 現在のスコープのバルーンサーフェスを変更します。 201 * 202 * @param id バルーンサーフェス ID 203 * @return このゴーストへの参照 204 */ 205 public SakuraGhost setBalloonSurface(int id) 206 { 207 if (currentShell != null) 208 { 209 SakuraBalloon balloon = currentShell.getBalloon(); 210 if (balloon != null) balloon.setSurface(id); 211 } 212 213 return this; 138 214 } 139 215 … … 145 221 public void draw(Graphics2D g) 146 222 { 147 SakuraShell sakura = shell.get( "0");148 SakuraShell kero = shell.get( "1");223 SakuraShell sakura = shell.get(0); 224 SakuraShell kero = shell.get(1); 149 225 150 226 Rectangle clip = g.getClipBounds(); … … 156 232 157 233 // サクラ 158 if (sakura != null )234 if (sakura != null && sakura.getSurface() != null) 159 235 { 160 236 AffineTransform tx = new AffineTransform(); … … 174 250 175 251 // ケロ 176 if (kero != null )252 if (kero != null && kero.getSurface() != null) 177 253 { 178 254 AffineTransform tx = new AffineTransform(); -
lang/java/NanikaKit/trunk/src/com/mac/tarchan/nanika/SakuraScript.java
r8673 r9007 8 8 package com.mac.tarchan.nanika; 9 9 10 import java.util.Scanner; 11 12 import org.apache.commons.logging.Log; 13 import org.apache.commons.logging.LogFactory; 14 10 15 /** 11 16 * このクラスは、さくらスクリプトを評価する機能を実装します。 12 17 * 13 * @ version1.018 * @since 1.0 14 19 * @author tarchan 15 20 */ 16 21 public class SakuraScript 17 22 { 23 /** ロガー */ 24 private static final Log log = LogFactory.getLog(SakuraScript.class); 25 18 26 /** 19 27 * さくらスクリプトを評価して、ゴーストを操作します。 … … 25 33 public static Object eval(String script, SakuraGhost ghost) 26 34 { 35 Scanner s = new Scanner(script).useDelimiter("\\\\"); 36 while (s.hasNext()) 37 { 38 String next = s.next(); 39 log.debug("next=" + next); 40 } 27 41 return null; 28 42 } -
lang/java/NanikaKit/trunk/src/com/mac/tarchan/nanika/SakuraShell.java
r8673 r9007 9 9 10 10 import java.awt.Graphics2D; 11 import java.awt.Point; 12 import java.awt.Rectangle; 11 import java.io.File; 12 import java.io.IOException; 13 import java.util.Arrays; 14 import java.util.HashMap; 15 import java.util.Properties; 16 import java.util.regex.Matcher; 17 import java.util.regex.Pattern; 13 18 14 19 import org.apache.commons.logging.Log; … … 16 21 17 22 import com.mac.tarchan.nanika.nar.NanikaArchive; 23 import com.mac.tarchan.nanika.nar.NanikaEntry; 18 24 19 25 /** 20 26 * このクラスは、シェルを表すために使用します。 21 27 * 22 * @ version1.028 * @since 1.0 23 29 * @author tarchan 24 30 */ … … 28 34 private static final Log log = LogFactory.getLog(SakuraShell.class); 29 35 30 /** 31 * シェル名 32 */ 36 /** シェル名 */ 33 37 private String name; 34 38 … … 39 43 private SakuraSurface surface; 40 44 41 /** バルーンオフセット */ 42 private Point balloonOffset = new Point(); 43 44 /** バルーン位置 */ 45 private Balloon balloonAlignment = Balloon.NONE; 46 47 /** バルーン位置情報 */ 48 private enum Balloon 49 { 50 /** 自動調整、shell の y軸座標が画面中央より左なら右、右なら左に表示 */ 51 NONE, 52 /** 常に左に表示 */ 53 LEFT, 54 /** 常に右に表示 */ 55 RIGHT, 56 }; 57 58 /** 説明文 */ 59 private String readme = "readme.txt"; 45 /** サーフェスリスト */ 46 private HashMap<Integer, SakuraSurface> surfaces = new HashMap<Integer, SakuraSurface>(); 47 48 // /** さくら側バルーンオフセット */ 49 // private Point sakuraBalloonOffset = new Point(); 50 // 51 // /** ケロ側バルーンオフセット */ 52 // private Point keroBalloonOffset = new Point(); 53 // 54 // /** バルーン位置 */ 55 // private Balloon balloonAlignment = Balloon.NONE; 56 // 57 // /** バルーン位置情報 */ 58 // private enum Balloon 59 // { 60 // /** 自動調整、shell の y軸座標が画面中央より左なら右、右なら左に表示 */ 61 // NONE, 62 // /** 常に左に表示 */ 63 // LEFT, 64 // /** 常に右に表示 */ 65 // RIGHT, 66 // }; 67 68 /** 詳細 */ 69 private Properties descript; 70 71 /** バルーン */ 72 private SakuraBalloon balloon; 60 73 61 74 /** … … 69 82 this.name = name; 70 83 this.nar = nar; 84 85 File shellHome = nar.getShellHome(); 86 87 // descript 88 try 89 { 90 descript = nar.getEntry(new File(shellHome, nar.getProperty("nanika.shell.descript"))).readDescript(); 91 log.debug("descript=" + descript); 92 } 93 catch (IOException e) 94 { 95 log.error("read shell descript error", e); 96 } 97 catch (NumberFormatException e) 98 { 99 log.error("parse int error", e); 100 } 101 102 // surface 103 loadSurface(); 104 105 // balloon 106 loadBalloon(name); 107 } 108 109 /** 110 * シェルを構築します。 111 * 112 * @param name シェル名 113 * @param pair ペアのシェル 114 */ 115 public SakuraShell(String name, SakuraShell pair) 116 { 117 this.name = name; 118 this.nar = pair.nar; 119 this.descript = pair.descript; 120 this.surfaces = pair.surfaces; 121 loadBalloon(name); 122 } 123 124 /** 125 * サーフェスを読み込みます。 126 */ 127 private void loadSurface() 128 { 129 File shellHome = nar.getShellHome(); 130 131 // image 132 NanikaEntry[] png = nar.list(new File(shellHome, "surface(.+)\\.png").getPath()); 133 log.debug("png=" + png.length + "," + Arrays.toString(png)); 134 Pattern p = Pattern.compile("surface(.+)\\.png"); 135 for (NanikaEntry entry : png) 136 { 137 String n = entry.getName(); 138 Matcher m = p.matcher(n); 139 m.find(); 140 int id = Integer.parseInt(m.group(1)); 141 surfaces.put(id, nar.getSurface(id)); 142 log.debug("entry=" + n + "," + id); 143 } 144 145 // collision 146 NanikaEntry[] txt = nar.list(new File(shellHome, "surface.+\\.txt").getPath()); 147 log.debug("txt=" + txt.length + "," + Arrays.toString(txt)); 148 } 149 150 /** 151 * バルーンを読み込みます。 152 * 153 * @param name 名前 154 */ 155 private void loadBalloon(String name) 156 { 157 try 158 { 159 // balloon 160 balloon = new SakuraBalloon(name, nar); 161 162 // balloon offset 163 int x = Integer.parseInt(descript.getProperty(name + ".balloon.offsetx", "0")); 164 int y = Integer.parseInt(descript.getProperty(name + ".balloon.offsety", "0")); 165 balloon.setOffset(x, y); 166 167 // balloon alignment 168 String align = descript.getProperty(name + ".balloon.alignment"); 169 balloon.setAlignment(align); 170 } 171 catch (IOException e) 172 { 173 log.error("read balloon error", e); 174 } 175 catch (Exception e) 176 { 177 log.error("read balloon error", e); 178 } 179 } 180 181 /** 182 * シェルの ID を返します。 183 * 184 * @return シェルの ID 185 */ 186 public String getId() 187 { 188 return descript.getProperty("id"); 189 } 190 191 /** 192 * シェルの名前を返します。 193 * 194 * @return シェルの名前 195 */ 196 public String getName() 197 { 198 return descript.getProperty("name"); 199 } 200 201 /** 202 * シェルの作成者名を返します。 203 * 204 * @return シェルの作成者名 205 */ 206 public String getCraftman() 207 { 208 return descript.getProperty("craftmanw", descript.getProperty("craftman")); 209 } 210 211 /** 212 * シェルのタイプを返します。 213 * 214 * @return シェルのタイプ 215 */ 216 public String getType() 217 { 218 return descript.getProperty("type"); 219 } 220 221 /** 222 * サーフェスの数を返します。 223 * 224 * @return サーフェスの数 225 */ 226 public int getSurfaceCount() 227 { 228 return surfaces.size(); 71 229 } 72 230 … … 76 234 * @param id サーフェス ID 77 235 */ 78 public void setSurface(String id) 79 { 80 log.debug(String.format("set surface: %s(%s)", name, id)); 81 surface = nar.getSurface(id); 236 public void setSurface(int id) 237 { 238 // surface = nar.getSurface(id); 239 if (surfaces.containsKey(id)) surface = surfaces.get(id); 240 else surface = null; 241 log.debug(String.format("set surface: %s(%s): %s", name, id, surface)); 82 242 } 83 243 … … 93 253 94 254 /** 255 * バルーンを返します。 256 * 257 * @return バルーン 258 */ 259 public SakuraBalloon getBalloon() 260 { 261 return balloon; 262 } 263 264 /** 95 265 * サーフェスを描画します。 96 266 * … … 100 270 { 101 271 if (surface != null) surface.draw(g); 102 } 103 104 /** 105 * 吹き出しの位置を返します。 106 * 107 * @param bounds シェルの表示範囲 108 * @return バルーンオフセット 109 */ 110 public Point getBalloonOffset(Rectangle bounds) 111 { 112 switch (balloonAlignment) 113 { 114 case NONE: 115 break; 116 case LEFT: 117 break; 118 case RIGHT: 119 break; 120 default: 121 break; 122 } 123 return new Point(balloonOffset); 124 } 272 if (balloon != null) balloon.draw(g); 273 } 274 275 // /** 276 // * 吹き出しの位置を返します。 277 // * 278 // * @param bounds シェルの表示範囲 279 // * @return バルーンオフセット 280 // */ 281 // public Point getBalloonOffset(Rectangle bounds) 282 // { 283 // switch (balloonAlignment) 284 // { 285 // case NONE: 286 // break; 287 // case LEFT: 288 // break; 289 // case RIGHT: 290 // break; 291 // default: 292 // break; 293 // } 294 // 295 // return new Point(sakuraBalloonOffset); 296 // } 125 297 126 298 /** … … 131 303 public String toString() 132 304 { 133 return String.format(" nar=%s, readme=%s", nar, readme);305 return String.format("shell: name=%s, %s", name, surface.getBounds()); 134 306 } 135 307 } -
lang/java/NanikaKit/trunk/src/com/mac/tarchan/nanika/SakuraSurface.java
r8673 r9007 29 29 * このクラスは、サーフェスを表すために使用します。 30 30 * 31 * @ version1.031 * @since 1.0 32 32 * @author tarchan 33 33 */ … … 38 38 39 39 /** サーフェス ID */ 40 private Stringid;40 private int id; 41 41 42 42 /** イメージ */ … … 52 52 * @param image サーフェスイメージ 53 53 */ 54 public SakuraSurface( Stringid, BufferedImage image)54 public SakuraSurface(int id, BufferedImage image) 55 55 { 56 56 this.id = id; -
lang/java/NanikaKit/trunk/src/com/mac/tarchan/nanika/nar/NanikaArchive.java
r8673 r9007 12 12 import java.io.FileFilter; 13 13 import java.io.IOException; 14 import java.util.LinkedList; 14 15 import java.util.Properties; 15 16 import java.util.zip.ZipEntry; … … 26 27 * このクラスは、NAR ファイルからエントリを読み込むために使用します。 27 28 * 28 * @ version1.029 * @since 1.0 29 30 * @author tarchan 30 31 * @see ZipFile … … 42 43 43 44 /** プロパティー */ 44 protected Properties properties = new Properties(getDefault ());45 protected Properties properties = new Properties(getDefaults()); 45 46 46 47 /** … … 81 82 * @return プロパティー 82 83 */ 83 private static Properties getDefault ()84 private static Properties getDefaults() 84 85 { 85 86 Properties defaults = new Properties(); … … 102 103 defaults.setProperty("nanika.shell.surfaces", "surfaces.txt"); 103 104 105 // balloon 106 defaults.setProperty("balloon.directory", "balloon"); 107 defaults.setProperty("balloon.descript", "descript.txt"); 108 104 109 // other 105 defaults.setProperty("nanika.balloon", "balloon");106 110 defaults.setProperty("nanika.headline", "headline"); 107 111 defaults.setProperty("nanika.plugin", "plugin"); 108 defaults.setProperty("balloon.directory", "balloon");109 112 110 113 return defaults; … … 181 184 { 182 185 ZipEntry zipEntry = zip.getEntry(file.getPath()); 183 log.debug("zipEntry=" + zipEntry);186 // log.debug("zipEntry=" + zipEntry); 184 187 return zipEntry != null ? new NanikaEntry(zip, zipEntry) : null; 185 188 } … … 193 196 public NanikaEntry[] list(String regex) 194 197 { 195 return new NanikaEntry[zip.size()]; 198 log.debug("regex=" + regex); 199 java.util.Enumeration<? extends ZipEntry> in = zip.entries(); 200 LinkedList<NanikaEntry> out = new LinkedList<NanikaEntry>(); 201 while (in.hasMoreElements()) 202 { 203 ZipEntry entry = in.nextElement(); 204 String name = entry.getName(); 205 if (name.matches(regex)) 206 { 207 log.debug("entry=" + name); 208 out.add(getEntry(name)); 209 } 210 } 211 212 return out.toArray(new NanikaEntry[0]); 196 213 } 197 214 … … 213 230 * @return サーフェス 214 231 */ 215 public SakuraSurface getSurface( Stringid)232 public SakuraSurface getSurface(int id) 216 233 { 217 234 File file = new File(getShellHome(), String.format("surface%s.png", id)); … … 237 254 238 255 /** 256 * バルーンを取得します。 257 */ 258 public void getBalloon() 259 { 260 try 261 { 262 File home = new File(getProperty("balloon.directory")); 263 log.debug("balloon=" + home); 264 NanikaEntry descript = getEntry(new File(home, getProperty("balloon.descript"))); 265 if (descript == null) return; 266 descript.readDescript(); 267 NanikaEntry balloons0 = getEntry(new File(home, "balloons0.png")); 268 if (balloons0 == null) return; 269 balloons0.readImage(); 270 } 271 catch (IOException e) 272 { 273 log.error("read balloon error", e); 274 } 275 } 276 277 /** 239 278 * サムネールを返します。 240 279 * … … 266 305 try 267 306 { 268 NanikaEntry entry = getEntry(getPropert ies().getProperty("nanika.readme"));307 NanikaEntry entry = getEntry(getProperty("nanika.readme")); 269 308 return entry != null ? entry.readText() : null; 270 309 } -
lang/java/NanikaKit/trunk/src/com/mac/tarchan/nanika/nar/NanikaEntry.java
r8673 r9007 28 28 * このクラスは、NAR ファイルエントリを表すために使用します。 29 29 * 30 * @ version1.030 * @since 1.0 31 31 * @author tarchan 32 32 * @see ZipFile -
lang/java/NanikaKit/trunk/src/test/com/mac/tarchan/nanika/NanikaMini.java
r8673 r9007 12 12 import java.awt.Graphics; 13 13 import java.awt.Graphics2D; 14 import java.awt.Rectangle; 14 15 import java.awt.geom.AffineTransform; 15 16 import java.awt.geom.RoundRectangle2D; … … 25 26 26 27 /** 27 * @version 1.0 28 * 何か。ミニ劇場を実装します。 29 * 30 * @since 1.0 28 31 * @author tarchan 29 32 */ … … 36 39 private SakuraGhost ghost; 37 40 38 // /** サクラ側サーフェス */39 // private SakuraSurface sakura;40 //41 // /** ケロ側サーフェス */42 // private SakuraSurface kero;43 44 41 /** サムネール */ 45 42 private BufferedImage thumbnail; 46 43 47 44 /** 45 * 何か。を実体化します。 46 * 48 47 * @param args <nar ファイル名> 49 48 */ … … 52 51 if (args.length == 0) 53 52 { 54 System.out.println("NanikaKit.jar < nar files>");53 System.out.println("NanikaKit.jar <ghost nar> <balloon nar> ..."); 55 54 System.exit(1); 56 55 } 57 56 58 NanikaMini mini = new NanikaMini();57 final NanikaMini mini = new NanikaMini(); 59 58 mini.setSize(640, 480); 59 // mini.setSize(800, 600); 60 60 mini.setNanika(args); 61 61 62 Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() 63 { 64 public void run() 65 { 66 log.info("えんいー"); 67 mini.ghost.vanish(); 68 } 69 })); 70 62 71 JFrame frame = new JFrame("Nanika mini"); 72 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 63 73 frame.getContentPane().add(mini); 64 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);65 74 // frame.setBackground(new Color(0, true)); 66 75 frame.pack(); … … 83 92 // name = "nanika/nar/nekoshoRX202.nar"; 84 93 // args[0] = "nanika/nar/alto_v110.nar"; 85 86 ghost = new SakuraGhost(); 87 // ghost.install(name); 94 // args = new String[]{"nanika/nar/akane_v118.zip", "nanika/balloon/defnekoko.ZIP"}; 95 // args = new String[]{"nanika/nar/sakura020212.nar"}; 88 96 89 97 // すべての NAR ファイルをインストール 98 ghost = new SakuraGhost(); 90 99 for (String name : args) 91 100 { … … 96 105 ghost.materialize(); 97 106 98 // NanikaArchive nar = new NanikaArchive(name); 99 // log.debug("nar=" + nar); 100 // Properties props = nar.getProperties(); 101 // log.debug("props=" + props); 102 // 103 // SakuraSurface surface0 = nar.getSurface("0"); 104 //// SakuraSurface surface0 = nar.getSurface("surface2053"); 105 // log.debug("surface0=" + surface0); 106 // sakura = surface0; 107 // 108 // SakuraSurface surface10 = nar.getSurface("10"); 109 // log.debug("surface10=" + surface10); 110 // kero = surface10; 111 // 112 // thumbnail = nar.getThumbnail(); 107 // サムネールを取得 113 108 thumbnail = ghost.getThumbnail(); 114 109 … … 137 132 * @param g Graphics2D コンテキスト 138 133 */ 139 p ublicvoid paint2d(Graphics2D g)134 private void paint2d(Graphics2D g) 140 135 { 141 136 log.debug("Graphics2D=" + g.getClass().getName()); … … 145 140 146 141 // 背景 142 Rectangle rect = g.getClipBounds(); 147 143 // g.setColor(Color.white); 148 144 // g.fill(g.getClipBounds()); … … 152 148 int x = 8; 153 149 int y = 8; 154 int w = 640- 16;155 // int h = 480- 16 - 22;156 int h = 480- 16;150 int w = rect.width - 16; 151 // int h = rect.height - 16 - 22; 152 int h = rect.height - 16; 157 153 int arcW = 16; 158 154 int arcH = 16; 159 155 // g.fillRoundRect(x, y, w, h, arcW, arcH); 160 156 RoundRectangle2D.Float rrect = new RoundRectangle2D.Float(x, y, w, h, arcW, arcH); 157 g.fill(rrect); 161 158 g.clip(rrect); 162 g.fill(rrect);163 159 // int right = x + w - 16; 164 160 // x += 128; … … 166 162 // int bottom = y + h; 167 163 164 // さくら&ケロを描画 168 165 if (ghost != null) ghost.draw(g); 169 166 170 // // サクラ 171 // if (sakura != null) 172 // { 173 // AffineTransform tx = new AffineTransform(); 174 //// tx.scale(0.8, 0.8); 175 //// Rectangle rect = sakura.getBounds(); 176 // Rectangle rect = tx.createTransformedShape(sakura).getBounds(); 177 // log.debug("rect=" + rect); 178 // rect.x = right - rect.width; 179 // rect.y = bottom - rect.height; 180 //// tx.shear(-0.5, 0); 181 // tx.rotate(Math.toRadians(0), right - rect.width / 2, bottom); 182 // tx.translate(rect.x, rect.y); 183 // g.setTransform(tx); 184 // sakura.draw(g); 185 // right = rect.x; 186 // } 187 // 188 // // ケロ 189 // if (kero != null) 190 // { 191 // AffineTransform tx = new AffineTransform(); 192 // Rectangle rect = kero.getBounds(); 193 // rect.x = x + (right - x) / 2 - rect.width / 2; 194 // rect.y = bottom - rect.height; 195 // tx.translate(rect.x, rect.y); 196 //// tx.shear(0.5, 0); 197 // g.setTransform(tx); 198 // kero.draw(g); 199 // } 200 201 // ロゴ 167 // サムネール&ロゴを描画 202 168 if (thumbnail != null) 203 169 {
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)