在 mousePressed 方法中,我不能使用任何与图形相关的方法,例如此代码将运行但不起作用
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
public class Control extends BasicGameState {
public static final int ID = 1;
public Graphics g = new Graphics();
public void init(GameContainer container, StateBasedGame game) throws SlickException{
}
public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
}
public void update(GameContainer container, StateBasedGame game, int delta) {
}
public void mousePressed(int button, int x, int y){
g.drawRect(x,y,2,2);
}
public int getID() {
return ID;
}
}
为什么没有任何面向图形的方法可以运行?
谢谢 - 沙姆斯