📄 tilemanger.java
字号:
// FrontEnd Plus GUI for JAD
// DeCompiled : tilemanger.class
import com.nokia.mid.ui.FullCanvas;
import java.io.PrintStream;
import javax.microedition.lcdui.*;
public class tilemanger extends FullCanvas
{
Image tiles[];
Image myimage;
Image mapscreen;
Graphics mapg;
int mapx;
int mapy;
int oldx;
int oldy;
int tilesindex;
int nowsrcw;
int nowsrch;
int tilesw;
int tilesh;
int mapwsize;
int maphsize;
int map[];
public tilemanger(int ai[], int i, int j)
{
tiles = new Image[21];
mapscreen = null;
mapx = 0;
mapy = 0;
oldx = 0;
oldy = 0;
tilesindex = 0;
nowsrcw = getWidth();
nowsrch = getHeight();
tilesw = 18;
tilesh = 22;
mapwsize = 8;
maphsize = 6;
addtile(0, "/0.png");
addtile(1, "/1.png");
addtile(2, "/2.png");
addtile(3, "/3.png");
addtile(4, "/4.png");
addtile(5, "/5.png");
addtile(6, "/6.png");
addtile(7, "/7.png");
addtile(8, "/8.png");
addtile(9, "/9.png");
addtile(10, "/10.png");
addtile(11, "/11.png");
addtile(12, "/12.png");
addtile(13, "/13.png");
addtile(14, "/14.png");
addtile(15, "/15.png");
addtile(16, "/16.png");
addtile(17, "/17.png");
addtile(18, "/18.png");
addtile(19, "/19.png");
addtile(20, "/20.png");
mapinit(ai, i, j);
}
public void mapinit(int ai[], int i, int j)
{
try
{
mapscreen = Image.createImage(18 * i, 22 * j);
mapg = mapscreen.getGraphics();
}
catch(Exception exception)
{
System.out.println(exception.getMessage());
}
map = ai;
mapwsize = i;
maphsize = j;
background(mapg);
}
public void mapchange(int ai[])
{
map = ai;
background(mapg);
}
public void paint(Graphics g)
{
}
public void addtile(int i, String s)
{
try
{
tiles[i] = Image.createImage(s);
}
catch(Exception exception)
{
System.out.println("picerr" + exception.getMessage());
}
}
public void drawmap(Graphics g, int i, int j)
{
mapx = i - nowsrcw / 2;
mapy = j - nowsrch / 2;
if(mapx <= 0)
mapx = 0;
if(mapx >= mapwsize * 18 - nowsrcw)
mapx = mapwsize * 18 - nowsrcw;
if(mapy <= 0)
mapy = 0;
if(mapy >= maphsize * 22 - nowsrch)
mapy = maphsize * 22 - nowsrch;
Graphics _tmp = g;
Graphics _tmp1 = g;
g.drawImage(mapscreen, -mapx, -mapy, 0x10 | 0x4);
}
public void background(Graphics g)
{
boolean flag = false;
int j = 0;
int k = 0;
for(int l = 0; l < maphsize; l++)
{
int i = 0;
for(int i1 = 0; i1 < mapwsize; i1++)
{
Graphics _tmp = g;
Graphics _tmp1 = g;
g.drawImage(tiles[map[k]], tilesw * i, tilesh * j, 0x10 | 0x4);
i++;
k++;
}
j++;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -