📄 tilesprite.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3)
// Source File Name: TileSprite.java
package se.southend.drops.gui;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import se.southend.drops.scene.Sprite;
public class TileSprite extends Sprite
{
public TileSprite(int argb, int width, int height)
{
nbrHorizontal = 1;
nbrVertical = 1;
setTileColor(argb);
setTileSize(width, height);
}
public TileSprite(Image image)
{
nbrHorizontal = 1;
nbrVertical = 1;
setImage(image);
}
public void setNbrTiles(int nbrHorizontal, int nbrVertical)
{
this.nbrHorizontal = nbrHorizontal;
this.nbrVertical = nbrVertical;
}
public void setImage(Image image)
{
this.image = image;
}
public int getTileColor()
{
return tileColor;
}
public void setTileColor(int argb)
{
tileColor = argb;
}
public void setTileSize(int width, int height)
{
tileWidth = width;
tileHeight = height;
argb = new int[width * height];
}
public int getWidth()
{
return image != null ? nbrHorizontal * image.getWidth() : nbrHorizontal * tileWidth;
}
public int getHeight()
{
return image != null ? nbrVertical * image.getHeight() : nbrVertical * tileHeight;
}
public void paint(Graphics graphics)
{
if(!isOnScreen())
return;
int xScr = getScreenX();
int yScr = getScreenY();
int width = image != null ? image.getWidth() : tileWidth;
int height = image != null ? image.getHeight() : tileHeight;
int xEnd = xScr + nbrHorizontal * width;
int yEnd = yScr + nbrVertical * height;
if(image == null)
{
int color = tileColor;
if(argb[0] != color)
{
for(int i = argb.length - 1; i >= 0; i--)
argb[i] = tileColor;
}
for(int y = yScr; y < yEnd; y += height)
{
for(int x = xScr; x < xEnd; x += width)
graphics.drawRGB(argb, 0, width, x, y, width, height, true);
}
} else
{
for(int y = yScr; y < yEnd; y += height)
{
for(int x = xScr; x < xEnd; x += width)
graphics.drawImage(image, x, y, 20);
}
}
}
private Image image;
private int argb[];
private int tileColor;
private int tileWidth;
private int tileHeight;
private int nbrHorizontal;
private int nbrVertical;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -