Java 如何修复Slick2d中的图像复制?
slick2d有一个小故障。我在窗户上画的画是复制品。我在运行eclipse的Windows7计算机上。我正在使用paint.net绘制图形这是它的外观: 我会有它的图像,但我还不能,对不起 这是我的图像代码:Java 如何修复Slick2d中的图像复制?,java,lwjgl,slick2d,Java,Lwjgl,Slick2d,slick2d有一个小故障。我在窗户上画的画是复制品。我在运行eclipse的Windows7计算机上。我正在使用paint.net绘制图形这是它的外观: 我会有它的图像,但我还不能,对不起 这是我的图像代码: /** * Images */ // Title Image title; public static int titleX = 100; public static int titleY = 500; // Play Button Image play; publi
/**
* Images
*/
// Title
Image title;
public static int titleX = 100;
public static int titleY = 500;
// Play Button
Image play;
public static int playX = 210;
public static int playY = 500;
// Options Button
Image options;
public static int optionsX = 310;
public static int optionsY = 500;
// Quit Button
Image quit;
public static int quitX = 410;
public static int quitY = 500;
public void init(GameContainer Gc, StateBasedGame Sbg)
throws SlickException {
/**
* Images
*/
title = new Image("gfx/main_menu/title/new_title.png");
play = new Image("gfx/main_menu/buttons/play_button.png");
options = new Image("gfx/main_menu/buttons/options_button.png");
quit = new Image("gfx/main_menu/buttons/quit_button.png");
}
public void render(GameContainer Gc, StateBasedGame Sbg, Graphics G)
throws SlickException {
/**
* Background
*/
G.setColor(Color.white);
G.fillRect(0, 0, w*s, h*s);
/**
* Images
*/
title.draw(titleY*s,titleX*s);
title.draw(playY*s,playX*s);
title.draw(optionsY*s,optionsX*s);
title.draw(quitY*s,quitX*s);
}
您正在绘制图像“标题”四次,但从未在其他图像上调用draw(播放、选项和退出)。更不用说我修复了它!这是一个非常有趣的错误,尽管我会放弃它!如果你不想回答这个问题,请自己回答。为什么你所有的位置变量都是静态的?没必要那样。