diff --git a/.vscode/settings.json b/.vscode/settings.json index 124523b..e1f4f91 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,12 +1,16 @@ { "java.project.referencedLibraries": [ - "/home/sillysagiri/Documents/wtk/lib/midpapi20.jar", - "/home/sillysagiri/Documents/wtk/lib/cldcapi11.jar", - "/home/sillysagiri/Documents/wtk/lib/midpapi20.jar", - "/home/sillysagiri/Documents/wtk/lib/mmapi.jar", + "library/j2me/*.jar", "library/tinygzip/tinylinegzip.jar" ], "java.project.sourcePaths": [ "src" - ] + ], + "dimmer.enabled": false, + "java.project.resourceFilters": [ + "node_modules", + "\\.git", + "microemu" + ], + "languageTool.enabled": false, } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..b71f1a7 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,37 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "run emulator", + "type": "shell", + "command": "java -jar /home/sillysagiri/Downloads/microemulator-2.0.4/microemulator.jar '${workspaceFolder}/build/dothack-allscreen_debug.jar'", + "problemMatcher": [], + }, + { + "label": "build debug", + "type": "shell", + "command": "ant debug", + "problemMatcher": [], + }, + { + "label": "build release", + "type": "shell", + "command": "ant release", + "problemMatcher": [], + }, + { + "label": "build & run", + "type": "shell", + "dependsOrder": "sequence", + "dependsOn": [ + "build debug", + "run emulator" + ], + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/src/MANIFEST b/src/MANIFEST new file mode 100644 index 0000000..2bf4c55 --- /dev/null +++ b/src/MANIFEST @@ -0,0 +1,10 @@ +MIDlet-1: dothack,/logo/menet.png,dothack.DotHack +MIDlet-Vendor: MeNet21 +MIDlet-Info-URL: http://java.sun.com/j2me +MIDlet-Name: dothack-allscreen +MIDlet-Description: MeNet21 +MIDlet-Version: 1.0 +MicroEdition-Configuration: CLDC-1.1 +MicroEdition-Profile: MIDP-2.0 +Sagiri-Note: dothack vol1 rewrite project +Sagiri-URL: https://sillysagiri.moe \ No newline at end of file diff --git a/src/dothack/DotHack.java b/src/dothack/DotHack.java index 46abf9a..95bde1b 100644 --- a/src/dothack/DotHack.java +++ b/src/dothack/DotHack.java @@ -1,54 +1,27 @@ package dothack; -import java.io.IOException; import javax.microedition.lcdui.Display; import javax.microedition.midlet.MIDlet; import sillysagiri.Sagiri; -import sillysagiri.scene.Instruction; +import sillysagiri.scene.Credits; import sillysagiri.scene.Intro; -import sillysagiri.scene.Leaderboard; import sillysagiri.scene.MainMenu; -import sillysagiri.scene.Options; -public class DotHack extends MIDlet implements Runnable { - public DotHackC game; +public class DotHack extends MIDlet { public Sagiri sagiri; private Display _display; public Thread thread; public void startApp() { Global.app = this; - sagiri = new Sagiri(); - game = new DotHackC(this); - _display = Display.getDisplay(this); - _display.setCurrent(game); + sagiri = new Sagiri(_display); + sagiri.Start(); - thread = new Thread(this); - thread.setPriority(Thread.MAX_PRIORITY); - thread.start(); - - sagiri.Set_Scene(new Options()); + sagiri.Set_Scene(new Intro()); } - public void pauseApp() {} - + public void pauseApp() {} public void destroyApp(boolean paramBoolean) {} - - public void run() { - while (true) { - sagiri.time_begin = System.currentTimeMillis(); - - game.repaint(); - game.serviceRepaints(); - - sagiri.input.Update(); - - try { Thread.sleep(1000/sagiri.fps); } - catch (Exception e) {} - - sagiri.time_delta = System.currentTimeMillis() - sagiri.time_begin; - } - } } \ No newline at end of file diff --git a/src/dothack/DotHackC.java b/src/dothack/DotHackC.java index 0791469..2f0d70c 100644 --- a/src/dothack/DotHackC.java +++ b/src/dothack/DotHackC.java @@ -151,31 +151,6 @@ public class DotHackC extends Canvas { sagiri.Update(g); } - public final void keyPressed(int keyCode) - { - sagiri.input.HandleKeyDown(keyCode); - } - - public final void keyReleased(int keyCode) - { - sagiri.input.HandleKeyUp(keyCode); - } - - public final void pointerPressed(int x, int y) - { - sagiri.input.HandleTouch(Sagiri.TOUCH_BEGIN, x, y); - } - - public final void pointerReleased(int x, int y) - { - sagiri.input.HandleTouch(Sagiri.TOUCH_END, x, y); - } - - public final void pointerDragged(int x, int y) - { - sagiri.input.HandleTouch(Sagiri.TOUCH_DRAG, x, y); - } - public void soundPlay(int id) { try { if (soundS) { diff --git a/src/sillysagiri/Sagiri.java b/src/sillysagiri/Sagiri.java index 77571a9..036a2d3 100644 --- a/src/sillysagiri/Sagiri.java +++ b/src/sillysagiri/Sagiri.java @@ -1,9 +1,18 @@ package sillysagiri; +import javax.microedition.lcdui.Canvas; +import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Graphics; -public class Sagiri +public class Sagiri extends Canvas implements Runnable { + /* + Note: + Device-specific keycodes vary + but only left/right soft keys are included + due to their significant variation across devices + https://j2me.fandom.com/wiki/Canvas_KeyCodes + */ public static final byte[] FONT_DEFAULT_GFX = new byte[]{-119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, -128, 0, 0, 0, 64, 8, 6, 0, 0, 0, -46, -42, 127, 127, 0, 0, 4, 111, 73, 68, 65, 84, 120, -100, -19, 92, -19, 110, -29, 48, 12, 75, -122, -66, -1, 43, -25, 126, -36, -91, -16, 105, -92, 68, -39, 110, -101, -44, 34, 48, 116, 115, 100, 89, -79, 105, 125, 109, -40, 126, 28, -57, -79, -59, -40, -1, 125, 30, 96, 108, 19, -97, -19, -50, -49, 118, 28, 61, 87, -58, 122, 100, -38, 53, 91, 88, 25, -5, -116, -55, 103, -11, -9, -40, -125, -26, 89, 59, -47, -103, -3, 90, -9, -79, -23, -16, 54, 82, 121, -58, 14, 61, -77, 118, 86, -57, -47, 124, 42, -13, -40, 65, -80, -71, 10, -87, -33, 37, -49, -50, -64, 37, -50, 79, 96, -128, 2, 123, -40, -116, -63, -52, -48, 118, -34, 6, 62, 103, -40, -123, -20, 25, -43, -49, -48, -82, -91, 30, 114, -106, -88, -54, 30, 75, -104, 65, -128, 118, 81, 100, -68, 114, 115, 119, -16, -39, -21, 45, -94, 53, 10, 13, 50, 33, 96, 4, 44, 84, 100, -26, 103, -25, -10, -36, -84, 44, 88, -34, -29, -27, 49, 51, -28, 35, -101, -84, 119, -96, 122, 102, 122, -128, 8, 54, 84, -12, -52, -75, -31, -31, 28, 67, 33, -28, 124, -34, -54, -51, -58, -34, 124, -87, -55, -76, 23, -105, 81, -62, -58, 72, -127, -34, -41, 75, -126, -95, 87, -99, 73, 0, -11, -58, -95, -61, 84, 95, 10, -35, 20, -5, 114, 17, -55, 90, 29, -81, -14, 12, -81, 6, 61, -48, -92, -114, 46, 2, 120, 37, 81, -60, 112, 106, -120, -7, -100, 113, 40, -17, 8, 1, 51, 16, 37, -85, -34, 56, -110, -53, -84, -101, -54, 1, -68, 13, 85, -22, 86, 43, -85, 26, 107, 117, 103, -26, 103, -41, 82, -61, 7, -14, 50, -97, 38, 24, -38, -89, 19, -12, 108, -10, 100, 35, -56, 42, -4, -12, 75, 23, 6, -47, 91, 5, 120, -15, -35, -54, 120, 46, -51, 107, 30, 33, 61, -84, 81, -109, -47, 63, 107, 92, -75, -109, -63, 75, -118, 35, -49, -123, 60, 34, -78, 3, -23, 108, 101, 82, 4, -56, 110, -72, 53, -88, -43, -93, -84, -61, 126, 102, -6, 123, -30, 124, -49, 97, -79, -79, -34, 60, 35, 59, 15, -55, 51, 59, -104, -36, 83, -26, -111, 88, -36, -58, -4, 111, 68, -44, 97, -5, 58, 60, 54, 63, 121, -101, -99, -28, -80, -110, -18, 19, 89, 122, 79, 34, 58, -110, 76, -38, -15, 17, 61, -98, 124, 106, 31, -111, 7, 80, 98, -97, 103, -64, -119, 76, 41, -40, 98, -26, 13, 100, 122, -108, -74, -11, -120, 13, 106, 46, 97, 109, -78, -13, -111, 30, 24, -53, -127, 126, -90, -13, -4, -2, -40, -74, -36, 111, 3, 85, -59, -98, 65, 42, 70, 110, -115, -94, -89, -57, -21, -68, 58, 52, 120, 73, -77, 39, -85, -28, 71, 22, -1, -27, 0, 89, -12, -34, -20, -85, -127, -111, -32, -114, -17, -78, 109, -99, 118, -97, 4, 80, 26, 32, -81, -40, -104, 79, -59, -1, 94, 92, 57, 65, -20, -38, -57, -109, 0, -39, -6, 23, 97, 38, 97, -34, 69, -56, 17, 2, -86, -99, 55, 102, -65, -94, 7, 97, 68, -10, 87, -18, -80, -125, 70, -96, -46, 24, 105, 113, -105, -37, 91, 0, -104, -111, 3, 88, 40, 77, 19, -5, -20, -44, -85, 38, 106, 81, -7, -88, -112, -41, -34, 8, -37, -103, 99, 99, -34, 59, 101, 26, 70, 106, -7, -35, 62, -13, -70, 123, 22, -111, -66, 103, 21, -64, 22, 83, 92, -45, -88, 55, -80, -101, 99, 95, -76, -73, 28, 85, 51, -29, -111, -104, 30, 101, -30, 89, 59, -93, 114, -47, 43, 35, -111, 45, -47, 37, 121, 86, 1, 61, 101, 4, 122, 126, -91, -28, 104, 118, 98, 121, -104, -49, 118, 99, 35, -110, -38, -34, -62, -91, 66, -26, -49, -10, -41, -88, -10, -53, 2, 53, 44, -48, -104, -6, 98, 89, -94, -76, -73, 20, 121, -116, 72, -33, -116, 77, 111, 15, -109, -35, 38, 102, -29, -91, -127, -86, 0, 15, -93, 47, -25, -59, -44, 59, -61, -34, 112, 70, 84, -108, 31, -76, 50, -83, -84, -59, -20, 18, 116, -88, 19, 104, 21, -55, 11, 54, 63, 95, -46, 37, 118, -128, 53, -109, 70, 114, -107, 40, -42, -37, -15, 104, 13, -108, -85, 61, 115, 0, 21, 40, 14, 34, -61, 34, 67, 70, 18, -59, -52, -19, -78, 115, 95, -123, -24, 16, -47, 126, -11, -64, 75, -42, -111, 45, -46, -7, 120, -99, 64, -117, 25, 55, -10, -50, -73, 30, 54, 82, -128, -116, 50, -26, -115, 51, 57, 69, -98, -123, 14, -118, 108, 14, -128, 22, -116, -54, -61, -88, -54, 96, 125, 0, -90, 63, -70, -15, -47, -102, 76, 70, 33, 39, -69, 85, -34, -58, 123, -67, 1, -91, -49, -64, 74, 59, -76, 94, -6, 28, -49, -65, 9, -116, 54, -52, 51, -46, 26, -15, -115, -24, 13, 49, 44, 57, 84, 63, -103, -98, 105, 24, 37, -128, 2, -11, 101, -108, 113, 11, -106, -32, -96, 121, 54, 38, 35, 89, 102, 115, 36, -93, -72, -34, 75, -122, 62, -106, 4, -86, 46, -36, -50, -119, 54, 81, -103, -57, 110, 2, -45, -19, 109, -76, 106, 83, 54, -119, 69, 54, 43, -13, 47, 7, -42, 9, 28, 77, 92, -20, -100, -84, 11, -53, 102, -10, -84, 36, 98, 113, 30, 61, -77, 122, -112, -25, -16, -86, -111, 91, -62, -85, 2, -68, -8, -34, -29, 33, 102, 64, 117, -51, 30, -68, 112, -106, -15, 28, 95, 65, -126, -13, -105, 65, -118, 123, -115, 98, -76, 7, -26, 54, 51, -7, -64, 43, 55, 59, -109, -3, 43, -29, -73, 1, -14, 0, -97, -122, -25, 106, 89, 71, 43, -45, -115, 108, -25, -38, -11, -20, -77, -81, -57, 104, 31, -96, 69, 116, 16, 94, -82, -31, 37, 84, 44, -39, 83, 117, -9, -116, 45, -125, -39, -1, 32, 98, -23, -51, -68, 35, -50, 42, 32, -45, -48, -79, -14, 117, -24, 55, 6, -6, -101, -64, -62, 66, 120, -25, -65, -120, 41, 92, 16, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, 81, 4, 88, 28, 69, -128, -59, -15, 7, 32, -16, -48, 36, 100, -115, 116, 87, 0, 0, 0, 0, 73, 69, 78, 68, -82, 66, 96, -126}; public static final byte[] FONT_DEFAULT_FNT = new byte[]{66, 77, 70, 3, 1, 20, 0, 0, 0, -10, -1, -64, 0, 100, 0, 1, 0, 0, 0, 0, 1, 1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0, 0, 15, 115, 0, 0, 0, 59, 0, 30, 0, 4, 0, 6, 0, 0, 0, 5, 0, 5, 0, 0, 15, 116, 0, 0, 0, 73, 0, 20, 0, 4, 0, 8, 0, 0, 0, 3, 0, 5, 0, 0, 15, 117, 0, 0, 0, 18, 0, 31, 0, 5, 0, 6, 0, 0, 0, 5, 0, 6, 0, 0, 15, 118, 0, 0, 0, 24, 0, 30, 0, 5, 0, 6, 0, 0, 0, 5, 0, 6, 0, 0, 15, 119, 0, 0, 0, 30, 0, 30, 0, 5, 0, 6, 0, 0, 0, 5, 0, 6, 0, 0, 15, 120, 0, 0, 0, 36, 0, 30, 0, 5, 0, 6, 0, 0, 0, 5, 0, 6, 0, 0, 15, 121, 0, 0, 0, 88, 0, 20, 0, 5, 0, 7, 0, 0, 0, 5, 0, 6, 0, 0, 15, 122, 0, 0, 0, 42, 0, 30, 0, 5, 0, 6, 0, 0, 0, 5, 0, 6, 0, 0, 15, 123, 0, 0, 0, 30, 0, 20, 0, 4, 0, 9, 0, 0, 0, 2, 0, 5, 0, 0, 15, 124, 0, 0, 0, 71, 0, 20, 0, 1, 0, 9, 0, 0, 0, 2, 0, 2, 0, 0, 15, 125, 0, 0, 0, 123, 0, 10, 0, 4, 0, 9, 0, 0, 0, 2, 0, 5, 0, 0, 15, 126, 0, 0, 0, 87, 0, 28, 0, 5, 0, 3, 0, 0, 0, 2, 0, 6, 0, 0, 15, 127, 0, 0, 0, 0, 0, 0, 0, 9, 0, 12, 0, 0, 0, 0, 0, 10, 0, 0, 15}; @@ -43,16 +52,29 @@ public class Sagiri public Input input; public int fps = 20; + private Display _display; private Scene _scene_current = null; - public long time_begin = 0; - public long time_delta = 0; + private long time_begin = 0; + private long time_delta = 0; - public Sagiri() + public Sagiri(Display display) { _instance = this; + _display = display; input = new Input(); } + public void Start() + { + + // main_thread = new Thread(this); + // main_thread.start(); + + _display.setCurrent(this); + setFullScreenMode(true); + _display.callSerially(this); + } + public void Update(Graphics g) { if (_scene_current != null) @@ -68,8 +90,8 @@ public class Sagiri } } - public Scene Get_Scene() { return _scene_current; } - public void Set_Scene(Scene scene) + public final Scene Get_Scene() { return _scene_current; } + public final void Set_Scene(Scene scene) { if (_scene_current != null) { @@ -81,4 +103,51 @@ public class Sagiri } public final long GetFrameTime() { return time_delta; } + + public void run() { + time_begin = 0; + time_delta = 0; + + time_begin = System.currentTimeMillis(); + + // render + repaint(); + serviceRepaints(); + + try { Thread.sleep(1000/fps); } catch (InterruptedException e) {} + + time_delta = System.currentTimeMillis() - time_begin; + + _display.callSerially(this); + } + + protected void paint(Graphics g) { + Update(g); + input.Update(); + } + + public final void keyPressed(int keyCode) + { + input.HandleKeyDown(keyCode); + } + + public final void keyReleased(int keyCode) + { + input.HandleKeyUp(keyCode); + } + + public final void pointerPressed(int x, int y) + { + input.HandleTouch(TOUCH_BEGIN, x, y); + } + + public final void pointerReleased(int x, int y) + { + input.HandleTouch(TOUCH_END, x, y); + } + + public final void pointerDragged(int x, int y) + { + input.HandleTouch(TOUCH_DRAG, x, y); + } } diff --git a/src/sillysagiri/Utils.java b/src/sillysagiri/Utils.java index e387e50..c706027 100644 --- a/src/sillysagiri/Utils.java +++ b/src/sillysagiri/Utils.java @@ -34,13 +34,13 @@ public final class Utils { public static void Clear_Screen(Graphics gg, int r, int g, int b) { gg.setColor(r,g,b); - gg.fillRect(0, 0, Global.app.game.getWidth(), Global.app.game.getHeight()); + gg.fillRect(0, 0, Global.app.sagiri.getWidth(), Global.app.sagiri.getHeight()); } public static void Clear_Screen(Graphics gg, int rgb) { gg.setColor(rgb); - gg.fillRect(0, 0, Global.app.game.getWidth(), Global.app.game.getHeight()); + gg.fillRect(0, 0, Global.app.sagiri.getWidth(), Global.app.sagiri.getHeight()); } public static void Clear_Image(Image img, int r, int g, int b) @@ -59,12 +59,12 @@ public final class Utils { public static int GetScreenWidth() { - return Global.app.game.getWidth(); + return Global.app.sagiri.getWidth(); } public static int GetScreenHeight() { - return Global.app.game.getHeight(); + return Global.app.sagiri.getHeight(); } public static int clamp(int value, int min, int max) { diff --git a/src/sillysagiri/scene/Credits.java b/src/sillysagiri/scene/Credits.java index 1226802..5ab6719 100644 --- a/src/sillysagiri/scene/Credits.java +++ b/src/sillysagiri/scene/Credits.java @@ -74,7 +74,5 @@ public class Credits extends Scene { bmf_white.Draw(g, "Remake:", 10, cursory+=bmf_white.lineHeight+3); bmf_white.DrawEx(g, "sillysagiri", Utils.GetScreenWidth()-10, cursory, Graphics.RIGHT|Graphics.TOP); - - bmf_white.Draw(g, "Dothack Network Discord", 10, cursory+=bmf_white.lineHeight+10); } }