Plantage quand je lance le jeu sur une autre machine
Bonjour a tous,
mon code s'exécute normalement depuis Eclipse, une fois compiler c'est pas la joie, et quand je l'exécute sur un autre ordinateur il freese a la première frame.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| package LGP;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;
public class Main extends StateBasedGame{
public static final String gamename = "LGP";
public static final int menu = 0;
public static final int help = 1;
public static final int game = 2;
public Main(String gamename){
super(gamename);
this.addState(new Menu(menu));
//this.addState(new Help(help));
//this.addState(new Game(game));
}
public void initStatesList(GameContainer gc) throws SlickException{
this.getState(menu).init(gc, this);
//this.getState(help).init(gc, this);
//this.getState(game).init(gc, this);
this.enterState(0);
}
public static void main(String[] args){
AppGameContainer appgc;
try {
appgc = new AppGameContainer(new Main(gamename));
appgc.setDisplayMode(appgc.getScreenWidth(), appgc.getScreenHeight(), false);
appgc.start();
} catch (SlickException e) {
e.printStackTrace();
}
}
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| package LGP;
import org.lwjgl.input.Mouse;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
public class Menu extends BasicGameState{
Image startGris, startRouge, helpGris, helpRouge, exitGris, exitRouge, background, start, exit, help;
public Menu(int state){
}
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
background = new Image("images/blood.png");
startGris = new Image("images/startGris.png");
startRouge = new Image("images/startRouge.png");
helpGris = new Image("images/helpGris.png");
helpRouge = new Image("images/helpRouge.png");
exitGris = new Image("images/exitGris.png");
exitRouge = new Image("images/exitRouge.png");
start = startGris;
help = helpGris;
exit = exitGris;
}
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
background.draw(gc.getWidth()/2 - background.getWidth()/2, 0);
start.draw(100, 100);
help.draw(100, 200);
exit.draw(100, 300);
}
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
int Xpos = Mouse.getX();
int Ypos = Mouse.getY();
if(Xpos > 140 && Xpos < 240 && Ypos > 940 && Ypos < 970){
start = startRouge;
if (Mouse.isButtonDown(0)){sbg.enterState(2);}
}else{start = startGris;}
if(Xpos > 140 && Xpos < 240 && Ypos > 840 && Ypos < 870){
help = helpRouge;
if (Mouse.isButtonDown(0)){sbg.enterState(1);}
}else{help = helpGris;}
if(Xpos > 140 && Xpos < 240 && Ypos > 740 && Ypos < 770){
exit = exitRouge;
if (Mouse.isButtonDown(0)){System.exit(0);}
}else{exit = exitGris;}
}
public int getID() {
return 0;
}
} |
Es-ce-que quelqu'un comprend ce qui ce passe.