diff --git a/assets/silly/bmf/nds12_0.png b/assets/silly/bmf/nds12_0.png index 284a551..a6a93e7 100644 Binary files a/assets/silly/bmf/nds12_0.png and b/assets/silly/bmf/nds12_0.png differ diff --git a/assets/silly/bmf/nds12_0.silly b/assets/silly/bmf/nds12_0.silly new file mode 100644 index 0000000..98338ba Binary files /dev/null and b/assets/silly/bmf/nds12_0.silly differ diff --git a/assets/silly/bmf/nds12_0.silly.gz b/assets/silly/bmf/nds12_0.silly.gz new file mode 100644 index 0000000..d63833d Binary files /dev/null and b/assets/silly/bmf/nds12_0.silly.gz differ diff --git a/src/dothack/DotHack.java b/src/dothack/DotHack.java index 80c63a7..3e62ee7 100644 --- a/src/dothack/DotHack.java +++ b/src/dothack/DotHack.java @@ -23,7 +23,7 @@ public class DotHack extends MIDlet implements Runnable { _display.setCurrent(game); thread = new Thread(this); - // thread.setPriority(Thread.MAX_PRIORITY); + thread.setPriority(Thread.MAX_PRIORITY); thread.start(); sagiri.Set_Scene(new Intro()); @@ -37,13 +37,13 @@ public class DotHack extends MIDlet implements Runnable { while (true) { sagiri.time_begin = System.currentTimeMillis(); - try { Thread.sleep(1000/sagiri.fps); } - catch (Exception e) {} - game.repaint(); game.serviceRepaints(); sagiri.input.Update(); + + try { Thread.sleep(1000/sagiri.fps); } + catch (Exception e) {} sagiri.time_delta = System.currentTimeMillis() - sagiri.time_begin; } diff --git a/src/sillysagiri/BMF.java b/src/sillysagiri/BMF.java index 43eda4f..c88f19e 100644 --- a/src/sillysagiri/BMF.java +++ b/src/sillysagiri/BMF.java @@ -1,11 +1,14 @@ package sillysagiri; +import java.io.ByteArrayOutputStream; import java.io.InputStream; import javax.microedition.lcdui.Graphics; import javax.microedition.lcdui.Image; import javax.microedition.lcdui.game.Sprite; +import sillysagiri.scene.DeathError; + public class BMF { public static final byte ID = 0; public static final byte X = 1; @@ -156,13 +159,64 @@ public class BMF { */ public void SetColor(int rgb) { - int[] buffer = new int[img.getWidth()*img.getHeight()]; - img.getRGB(buffer, 0, img.getWidth(), 0, 0, img.getWidth(), img.getHeight()); - - for (int i=0; i> 15) & 0x01); + char blue = (char)((i >> 10) & 0x1F); + char green = (char)((i >> 5) & 0x1F); + char red = (char)(i & 0x1F); + + // Scale the 5-bit values to 8-bit + if (alpha == 1) alpha = 255; + else alpha = 0; + + red = (char)((red << 3) | 0x07); + blue = (char)((green << 3) | 0x07); + green = (char)((blue << 3) | 0x07); + + // Combine into 24-bit value AARRGGBB + buffer[pointer] = (alpha << 24) | (red << 16) | (green << 8) | blue; + pointer++; + } + + // img = Image.createRGBImage(buffer, img.getWidth(), img.getHeight(), true); + img = Image.createRGBImage(buffer, 128, 64, true); + } + catch(Exception e) + { + e.printStackTrace(); + Sagiri._instance.Set_Scene(new DeathError(e)); + } } // TODO: handle multiline diff --git a/src/sillysagiri/Input.java b/src/sillysagiri/Input.java index 3276b5a..d6992d7 100644 --- a/src/sillysagiri/Input.java +++ b/src/sillysagiri/Input.java @@ -1,21 +1,17 @@ package sillysagiri; public final class Input { - public int state_keycode = KeyCode.NONE; + public int state_keycode = Sagiri.KEY_NONE; public int state_keyphase = 0; public int state_touchState = Sagiri.TOUCH_NONE; public int touchX = 0; public int touchY = 0; - - public Input() - { - } public final void Update() { - if (state_keyphase == 0) state_keyphase = KeyCode.NONE; - if (state_keyphase != 0 && state_keyphase != KeyCode.NONE) state_keyphase++; + if (state_keyphase == 0) state_keyphase = Sagiri.KEY_NONE; + if (state_keyphase != 0 && state_keyphase != Sagiri.KEY_NONE) state_keyphase++; state_touchState = Sagiri.TOUCH_NONE; } diff --git a/src/sillysagiri/scene/Intro.java b/src/sillysagiri/scene/Intro.java index d48c4a9..026469a 100644 --- a/src/sillysagiri/scene/Intro.java +++ b/src/sillysagiri/scene/Intro.java @@ -1,6 +1,5 @@ package sillysagiri.scene; import java.io.IOException; -import java.util.Enumeration; import javax.microedition.lcdui.Graphics; import javax.microedition.lcdui.Image; @@ -8,8 +7,6 @@ import javax.microedition.lcdui.game.Sprite; import sillysagiri.BMF; import sillysagiri.Easing; -import sillysagiri.Input; -import sillysagiri.KeyCode; import sillysagiri.Scene; import sillysagiri.Utils; @@ -29,7 +26,7 @@ public class Intro extends Scene { bmf_normal = BMF.Create("/silly/bmf/nds12_0.png", "/silly/bmf/nds12.fnt"); bmf_outline = BMF.Create("/silly/bmf/onds12_0.png", "/silly/bmf/onds12.fnt"); bmf_black = BMF.Create("/silly/bmf/nds12_0.png", "/silly/bmf/nds12.fnt"); - bmf_black.SetColor(0xFF000000); + bmf_black.SetColor(0xFFFF0000); img_logo = Image.createImage("/t_1.png"); } catch(Exception e) @@ -131,6 +128,8 @@ public class Intro extends Scene { Utils.GetScreenWidth()/2, (int)(Utils.GetScreenHeight()*0.7), Graphics.VCENTER | Graphics.HCENTER); + g.drawImage(bmf_black.img, 0, 0, 20); + if (sagiri.input.IsKeyDownAny()) sagiri.Set_Scene(new MainMenu()); }