layer.java
来自「手机射击游戏源代码,nokia s60模拟器开发包,eclipse工具开发.不可」· Java 代码 · 共 53 行
JAVA
53 行
package src;
import javax.microedition.lcdui.Graphics;
public abstract class Layer {
protected int x;
protected int y;
protected int width;
protected int height;
protected boolean visible;
protected Layer(int width, int height) {
visible = true;
setWidthImpl(width);
setHeightImpl(height);
}
public void setPosition(int x, int y) {
this.x = x;
this.y = y;
}
public void move(int dx, int dy) {
x += dx;
y += dy;
}
public final int getWidth() {
return width;
}
public final int getHeight() {
return height;
}
public abstract void paint(Graphics g);
void setWidthImpl(int width) {
if (width < 0) {
throw new IllegalArgumentException();
} else {
this.width = width;
}
}
void setHeightImpl(int height) {
if (height < 0) {
throw new IllegalArgumentException();
} else {
this.height = height;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?