你如何修复Slick2d中的图像重复?

时间:2013-05-20 21:38:46

标签: java lwjgl slick2d

slick2d出现故障。我把它画在窗口上的图片重复。我在运行eclipse的Windows 7计算机上。我正在使用paint.net作为我的图形,这就是它的样子:

我会想到它的形象,但我还不能,抱歉。

这是我的图片代码:

    /**
 * 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);
}

1 个答案:

答案 0 :(得分:0)

您正在四次绘制图像“标题”,而从不在其他图像上调用绘图(播放,选项和退出)。

相关问题