moving main canvas display into Sagiri class
This commit is contained in:
parent
5db84aa14e
commit
5588fd5110
14
.vscode/settings.json
vendored
14
.vscode/settings.json
vendored
@ -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,
|
||||
}
|
37
.vscode/tasks.json
vendored
Normal file
37
.vscode/tasks.json
vendored
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
10
src/MANIFEST
Normal file
10
src/MANIFEST
Normal file
@ -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
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user