diff --git a/assets/silly/bmf/nds12.fnt b/assets/silly/bmf/nds12.fnt new file mode 100644 index 0000000..faacb6a Binary files /dev/null and b/assets/silly/bmf/nds12.fnt differ diff --git a/assets/silly/bmf/nds12.png b/assets/silly/bmf/nds12.png new file mode 100644 index 0000000..284a551 Binary files /dev/null and b/assets/silly/bmf/nds12.png differ diff --git a/assets/silly/bmf/onds12.fnt b/assets/silly/bmf/onds12.fnt new file mode 100644 index 0000000..a41868f Binary files /dev/null and b/assets/silly/bmf/onds12.fnt differ diff --git a/assets/silly/bmf/onds12.png b/assets/silly/bmf/onds12.png new file mode 100644 index 0000000..2291ced Binary files /dev/null and b/assets/silly/bmf/onds12.png differ diff --git a/raw/nds12/NDS12.ttf b/raw/nds12/NDS12.ttf new file mode 100644 index 0000000..ea33f98 Binary files /dev/null and b/raw/nds12/NDS12.ttf differ diff --git a/raw/nds12/config.bmfc b/raw/nds12/config.bmfc new file mode 100644 index 0000000..222d811 --- /dev/null +++ b/raw/nds12/config.bmfc @@ -0,0 +1,59 @@ +# AngelCode Bitmap Font Generator configuration file +fileVersion=1 + +# font settings +fontName=NDS12 +fontFile= +charSet=0 +fontSize=-10 +aa=1 +scaleH=100 +useSmoothing=1 +isBold=0 +isItalic=0 +useUnicode=1 +disableBoxChars=1 +outputInvalidCharGlyph=0 +dontIncludeKerningPairs=0 +useHinting=0 +renderFromOutline=0 +useClearType=1 +autoFitNumPages=0 +autoFitFontSizeMin=0 +autoFitFontSizeMax=0 + +# character alignment +paddingDown=0 +paddingUp=0 +paddingRight=0 +paddingLeft=0 +spacingHoriz=1 +spacingVert=1 +useFixedHeight=0 +forceZero=0 +widthPaddingFactor=0.00 + +# output file +outWidth=128 +outHeight=64 +outBitDepth=32 +fontDescFormat=2 +fourChnlPacked=0 +textureFormat=png +textureCompression=0 +alphaChnl=1 +redChnl=0 +greenChnl=0 +blueChnl=0 +invA=0 +invR=0 +invG=0 +invB=0 + +# outline +outlineThickness=1 + +# selected chars +chars=32-127 + +# imported icon images diff --git a/raw/nds12/license.txt b/raw/nds12/license.txt new file mode 100644 index 0000000..bb433a9 --- /dev/null +++ b/raw/nds12/license.txt @@ -0,0 +1,8 @@ +License for NDS12 font + +This font was created by Caveras with FontStruct and is licensed +under a Creative Commons Attribution Non-commercial Share Alike +license. + +http://fontstruct.com/fontstructors/caveras +http://creativecommons.org/licenses/by-nc-sa/3.0/ \ No newline at end of file diff --git a/raw/nds12/nds12.fnt b/raw/nds12/nds12.fnt new file mode 100644 index 0000000..faacb6a Binary files /dev/null and b/raw/nds12/nds12.fnt differ diff --git a/raw/nds12/nds12.png b/raw/nds12/nds12.png new file mode 100644 index 0000000..284a551 Binary files /dev/null and b/raw/nds12/nds12.png differ diff --git a/raw/nds12/onds12.fnt b/raw/nds12/onds12.fnt new file mode 100644 index 0000000..a41868f Binary files /dev/null and b/raw/nds12/onds12.fnt differ diff --git a/raw/nds12/onds12_0.png b/raw/nds12/onds12_0.png new file mode 100644 index 0000000..2291ced Binary files /dev/null and b/raw/nds12/onds12_0.png differ diff --git a/raw/nds12/readme.txt b/raw/nds12/readme.txt new file mode 100644 index 0000000..6eaa27b --- /dev/null +++ b/raw/nds12/readme.txt @@ -0,0 +1,29 @@ +NDS12 by Caveras - based on the original system font of the Nintendo DS. + +The font file in this archive was created by Caveras using FontStruct - +the free, online font-building tool. This font has a homepage where this +archive and other versions may be found: +http://fontstruct.com/fontstructors/caveras + +It is also distributed over Caveras' website: http://www.caveras.net + +Try FontStruct at http://fontstruct.com - It’s easy and it’s fun. + +NOTE FOR FLASH USERS: FontStruct fonts (FontStructions) are optimized for +Flash. The font in this archive is a pixel font and best displayed at a +font-size of 16 and multiples of this number. + +FontStruct is sponsored by FontShop. Visit them at http://fontshop.com. +FontShop is the original independent font retailer. We’ve been around since +the dawn of digital type. Whether you need the right font or need to create +the right font from scratch, let our 23 years of experience work for you. + +FontStruct is copyright © 2016 Rob Meek + +LEGAL NOTICE: +In using this font you must comply with the licensing terms described in the +file “license.txt” included with this archive. If you redistribute the font +file in this archive, it must be accompanied by all the other files from this +archive, including this one. + +Copyright © 2016 Caveras / Cliff Modes. \ No newline at end of file diff --git a/src/sillysagiri/BMF.java b/src/sillysagiri/BMF.java new file mode 100644 index 0000000..d2fb195 --- /dev/null +++ b/src/sillysagiri/BMF.java @@ -0,0 +1,133 @@ +package sillysagiri; + +import java.io.InputStream; + +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +public class BMF { + public static final byte ID = 0; + public static final byte X = 1; + public static final byte Y = 2; + public static final byte WIDTH = 3; + public static final byte HEIGHT = 4; + public static final byte XOFF = 5; + public static final byte YOFF = 6; + public static final byte XADV = 7; + + public Image img; + public short fontSize; + public short lineHeight; + public short base; + public short[][] chars; + + public BMF(String path_img, String path_fnt) throws Exception + { + img = Image.createImage(path_img); + + InputStream in = this.getClass().getResourceAsStream(path_fnt); + byte[] header = new byte[4]; + + int size_read = in.read(header, 0, 4); + if (!(size_read == 4) && + !(header[0] != 'B') && + !(header[1] != 'M') && + !(header[2] != 'F') && + !(header[3] != 3)) + { + throw new Exception("File is not bmf " + path_fnt); + } + + header = null; + byte[] buffer = new byte[20]; + while(size_read != -1) + { + int length; + int type; + + // read type & length + size_read = in.read(buffer, 0, 5); + if (size_read == -1) break; + + // get type from buffer + type = buffer[0]; + + // convert byte into int; + length = ((buffer[4] & 0xFF) << 24) | + ((buffer[3] & 0xFF) << 16) | + ((buffer[2] & 0xFF) << 8) | + (buffer[1] & 0xFF); + + switch (type) { + case 1: // info block + { + // font size is signed + size_read = in.read(buffer, 0, 2); + fontSize = (short)( ((buffer[1]) << 8) | + (buffer[0]) ); + + // skip the rest + in.skip(length - 2); + } + break; + + case 2: // common block + { + size_read = in.read(buffer, 0, 4); + lineHeight = (short)( ((buffer[1] & 0xFF) << 8) | + (buffer[0]) & 0xFF); + + base = (short)( ((buffer[3] & 0xFF) << 8) | + (buffer[2]) & 0xFF); + + // skip the rest + in.skip(length - 4); + } + break; + + case 3: // pages block + { + // skip pages + in.skip(length); + } + break; + + case 4: // chars block + { + chars = new short[96][8]; + int count = length/20; + for (int i=0; i 128) continue; + + chars[id-32][ID] = (short)(((buffer[1] & 0xFF) << 8) | (buffer[0] & 0xFF)); + chars[id-32][X] = (short)(((buffer[5] & 0xFF) << 8) | (buffer[4] & 0xFF)); + chars[id-32][Y] = (short)(((buffer[7] & 0xFF) << 8) | (buffer[6] & 0xFF)); + chars[id-32][WIDTH] = (short)(((buffer[9] & 0xFF) << 8) | (buffer[8] & 0xFF)); + chars[id-32][HEIGHT] = (short)(((buffer[11] & 0xFF) << 8) | (buffer[10] & 0xFF)); + chars[id-32][XOFF] = (short)((buffer[13] << 8) | buffer[12]); + chars[id-32][YOFF] = (short)((buffer[15] << 8) | buffer[14]); + chars[id-32][XADV] = (short)((buffer[17] << 8) | buffer[16]); + } + } + break; + + default: + break; + } + } + } + + public void Draw(Graphics g, String str, int x, int y) + { + short[] cursor = new short[]{0, 0}; + } + +} diff --git a/src/sillysagiri/scene/DeathError.java b/src/sillysagiri/scene/DeathError.java new file mode 100644 index 0000000..44f0bed --- /dev/null +++ b/src/sillysagiri/scene/DeathError.java @@ -0,0 +1,29 @@ +package sillysagiri.scene; + +import javax.microedition.lcdui.Graphics; + +import sillysagiri.Scene; +import sillysagiri.Utils; + +public class DeathError extends Scene { + Exception e; + public DeathError(Exception e) + { + super(); + this.e = e; + } + + public void Preload() { + } + + public void Destroy() { + } + + public void Update(long dt, Graphics g) { + // TODO: improve death message + Utils.Clear_Screen(g, 255, 255, 255); + g.setColor(255, 0 , 0); + g.drawString(e.toString(), 0, 0, Graphics.LEFT|Graphics.TOP); + } + +} diff --git a/src/sillysagiri/scene/MainMenu.java b/src/sillysagiri/scene/MainMenu.java new file mode 100644 index 0000000..5879501 --- /dev/null +++ b/src/sillysagiri/scene/MainMenu.java @@ -0,0 +1,79 @@ +package sillysagiri.scene; + +import java.io.IOException; + +import javax.microedition.lcdui.Graphics; +import javax.microedition.lcdui.Image; + +import sillysagiri.BMF; +import sillysagiri.Scene; +import sillysagiri.Utils; + +public class MainMenu extends Scene { + private long counter = 0; + private int state = 0; + + private Image img_bg; + private Image img_bandai; + private Image img_ez; + + public void Preload() { + try { + BMF bmf = new BMF("/silly/bmf/nds12.png", "/silly/bmf/nds12.fnt"); + Image img_loop = Image.createImage("/m_2.png"); + img_bandai = Image.createImage("/c_0.png"); + img_ez = Image.createImage("/pEZ.png"); + + int loopCount = (int)Math.ceil((float)Utils.GetScreenHeight()/img_loop.getHeight()); + + img_bg = Image.createImage(img_loop.getWidth(), Utils.GetScreenHeight()); + Utils.Clear_Image(img_bg, 255, 108, 0); + Graphics g_bg = img_bg.getGraphics(); + + for (int i = 0; i= 600) counter = 0; + if (counter < 400) + g.drawImage( + img_ez, + Utils.GetScreenWidth()/2, (int)(Utils.GetScreenHeight()*0.75), + Graphics.VCENTER | Graphics.HCENTER); + + if (sagiri.input.IsKeyDownAny()) + { + counter = 0; + state = 1; + } + } + break; + + default: break; + } + } +} +