diff --git a/3x.png b/3x.png new file mode 100644 index 0000000..5809ad0 Binary files /dev/null and b/3x.png differ diff --git a/scripts/md5 b/scripts/md5 index c4273a3..c986421 100644 --- a/scripts/md5 +++ b/scripts/md5 @@ -1,5 +1,5 @@ -build.sh:a833e7598ad65672a9c01306d244b49f - -clean.sh:96ce35f2d2dcb555421e00a6afda23ca - -commit.sh:21af1fa6f09d01679c9e11408967264a - -jar.sh:2ac636f584c43a1124affb9ea6bdc7bf - -lean.sh:3be7b8b182ccd96e48989b4e57311193 - +build.sh:de32fdf9f3ce9eb5d4ea9902ee48dbe0 *- +clean.sh:8aec15e447257f1c3a4e978f1b56a78e *- +commit.sh:21af1fa6f09d01679c9e11408967264a *- +jar.sh:2ac636f584c43a1124affb9ea6bdc7bf *- +lean.sh:3be7b8b182ccd96e48989b4e57311193 *- diff --git a/sig b/sig index 5f8d83f..1978b84 100755 --- a/sig +++ b/sig @@ -1,6 +1,6 @@ source utils/define.sh -define PROJECT_NAME "JavaProjectTemplate" +define PROJECT_NAME "RabiClone" define PROJECT_DIR "src/sig" define MAIN_CLASS "sig.${PROJECT_NAME}" define OUT_DIR "bin" diff --git a/src/sig/JavaProjectTemplate.java b/src/sig/RabiClone.java similarity index 55% rename from src/sig/JavaProjectTemplate.java rename to src/sig/RabiClone.java index ac5ae34..1077d47 100644 --- a/src/sig/JavaProjectTemplate.java +++ b/src/sig/RabiClone.java @@ -1,14 +1,17 @@ package sig; +import javax.imageio.ImageIO; import javax.swing.JFrame; import sig.engine.Panel; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; -public class JavaProjectTemplate { +public class RabiClone { public static final String PROGRAM_NAME="Sig's Java Project Template"; public static void main(String[] args) { JFrame f = new JFrame(PROGRAM_NAME); Panel p = new Panel(f); - p.init(); f.add(p); @@ -17,5 +20,12 @@ public class JavaProjectTemplate { f.setVisible(true); p.render(); + BufferedImage nana; + try { + nana = ImageIO.read(new File("..","3x.png")); + p.Draw_Nana(p.Get_Nana(nana)); + } catch (IOException e) { + e.printStackTrace(); + } } } diff --git a/src/sig/engine/Panel.java b/src/sig/engine/Panel.java index 2f558f7..ac76f75 100644 --- a/src/sig/engine/Panel.java +++ b/src/sig/engine/Panel.java @@ -6,13 +6,17 @@ import java.awt.Image; import java.awt.Toolkit; import java.awt.image.ColorModel; import java.awt.image.MemoryImageSource; +import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.awt.image.BufferedImage; +import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; -import sig.JavaProjectTemplate; +import sig.RabiClone; public class Panel extends JPanel implements Runnable { JFrame window; @@ -32,6 +36,7 @@ public class Panel extends JPanel implements Runnable { int frameCount=0; long lastSecond=0; int lastFrameCount=0; + Sprite nana_sprite; public Panel(JFrame f) { super(true); @@ -54,6 +59,13 @@ public class Panel extends JPanel implements Runnable { * Call it after been visible and after resizes. */ public void init(){ + BufferedImage nana; + try { + nana = ImageIO.read(new File("..","3x.png")); + nana_sprite = Get_Nana(nana); + } catch (IOException e) { + e.printStackTrace(); + } cm = getCompatibleColorModel(); int screenSize = width * height; if(pixel == null || pixel.length < screenSize){ @@ -80,7 +92,7 @@ public class Panel extends JPanel implements Runnable { if (window!=null&&System.currentTimeMillis()-lastSecond>=1000) { - window.setTitle(JavaProjectTemplate.PROGRAM_NAME+" - FPS: "+(frameCount-lastFrameCount)); + window.setTitle(RabiClone.PROGRAM_NAME+" - FPS: "+(frameCount-lastFrameCount)); lastFrameCount=frameCount; lastSecond=System.currentTimeMillis(); } @@ -99,49 +111,25 @@ public class Panel extends JPanel implements Runnable { * Do your draws in here !! * pixel is your canvas! */ + + public /* abstract */ void render(){ int[] p = pixel; // this avoid crash when resizing //a=h/w - for (int x=0;x