?? mobilebackground.java
字號:
package game.terrain;
import javax.microedition.m3g.*;
public class MobileBackground
{
private final static int STEP = 3;
private Background backGnd;
private boolean isMoveable = false;
private int width, height;
public MobileBackground(Image2D backIm, int w, int h)
{
width = w; height = h;
backGnd = new Background();
if (backIm != null) {
backGnd.setImage( backIm );
backGnd.setImageMode(Background.REPEAT, Background.REPEAT);
backGnd.setCrop(backGnd.getCropX(), backGnd.getCropY(), width, height);
isMoveable = true;
}
else
backGnd.setColor(0x00bffe);
}
public Background getBackground()
{ return backGnd; }
public void moveRight(int factor)
{ if (isMoveable)
backGnd.setCrop(backGnd.getCropX()-(STEP*factor),
backGnd.getCropY(), width, height);
}
public void moveLeft(int factor)
{ if (isMoveable)
backGnd.setCrop(backGnd.getCropX()+(STEP*factor),
backGnd.getCropY(), width, height);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -