このコードを使用して、画像を描画しようとしています:
g.drawImage(Tile.background, (int)spritePositionX, (int)spritePositionY, null);
Tile.background の私のタイル クラスは次のとおりです。
public class Tile {
public static int size = 40;
public static BufferedImage terrain, background, items, characters;
public Tile(){
try{
Tile.background = ImageIO.read(new File("res/bg.png"));
Tile.terrain = ImageIO.read(new File("res/terrain.png"));
Tile.items = ImageIO.read(new File("res/items.png"));
Tile.characters = ImageIO.read(new File("characters/bg.png"));
}catch(Exception e){
System.out.println("Error loading images.");
}
}
}
それは私にこのエラーを与えます:タイプGraphicsのメソッドdrawImage(Image、float、float、Color)は、引数(BufferedImage、int、int、null)には適用できません
これらは、g.drawImage があるクラスの私のインポートです。
import javax.swing.ImageIcon;
import org.lwjgl.input.Mouse;
import org.newdawn.slick.*;
import org.newdawn.slick.state.*;
import java.awt.Rectangle;