/**
  * Boucle main
  *
  * @param args l'argument quand on lance le programme
  * @throws SlickException
  */
 public static void main(String[] args) throws SlickException {
   loadNatives(Game.class);
   AppGameContainer appGc;
   try {
     appGc = new AppGameContainer(new Game(GAMENAME));
     appGc.setDisplayMode(WIDTH, HEIGHT, false);
     appGc.setShowFPS(false);
     appGc.start();
   } catch (SlickException ex) {
     ex.printStackTrace();
   }
 }
示例#2
0
 public static void main(String args[]) {
   AppGameContainer appgc;
   try {
     appgc = new AppGameContainer(new Game());
     appgc.setDisplayMode(WINDOW_WIDTH, WINDOW_HEIGHT, false);
     // appgc.setFullscreen(true);
     appgc.setTargetFrameRate(15);
     appgc.start();
   } catch (SlickException ex) {
     ex.printStackTrace();
   }
 }
示例#3
0
 public void keyPressed(int key, char c) {
   switch (key) {
     case Input.KEY_DOWN:
       fx.play();
       selected++;
       if (selected >= options.length) {
         selected = 0;
       }
       break;
     case Input.KEY_UP:
       fx.play();
       selected--;
       if (selected < 0) {
         selected = options.length - 1;
       }
       break;
     case Input.KEY_ENTER:
       switch (selected) {
         case 1:
           try {
             game.getState(prevGameState).init(game.getContainer(), game);
           } catch (SlickException e) {
             e.printStackTrace();
           }
           // Break weggelassen, um case 0 auch auszufuehren
         case 0:
           game.enterState(
               prevGameState,
               new FadeOutTransition(Color.black, 100),
               new FadeInTransition(Color.black, 100));
           break;
         case 2:
           game.enterState(
               MainMenu.stateID,
               new FadeOutTransition(Color.black, 100),
               new FadeInTransition(Color.black));
           break;
       }
       break;
     case Input.KEY_ESCAPE:
     case Input.KEY_P:
       game.enterState(
           prevGameState,
           new FadeOutTransition(Color.black, 100),
           new FadeInTransition(Color.black, 100));
       break;
     default:
       break;
   }
 }
示例#4
0
 /**
  * O método main desta classe faz algumas configurações importantes para o jogo.
  *
  * @param args
  */
 public static void main(String[] args) {
   AppGameContainer appgc;
   try {
     appgc = new AppGameContainer(new Main(gamename));
     appgc.setDisplayMode(
         width, height, false); // configura o tamanho da tela e desabilita full screen.
     appgc.setTargetFrameRate(fps); // limita quantidade de FPS
     appgc.setShowFPS(false); // configura para que o fps não seja mostrado na tela do jogo
     appgc.setForceExit(
         false); // diz que a aplicação não vai ser abortada após o jogador fechar a tela do jogo.
     appgc.start(); // inicia o app game container
   } catch (SlickException e) {
     e.printStackTrace();
   }
 }
示例#5
0
 public void load() {
   new Chars();
   new Attacks();
   new StoryCreator();
   Chars.createSpriteSheets();
   Chars.createAnimations();
   Attacks.createSpriteSheets();
   Attacks.createAnimations();
   StoryCreator.setDialog1();
   try {
     Map.gameInitMethod();
     StartMenu.menuInit();
   } catch (SlickException e) {
     e.printStackTrace();
   }
   doneLoading = true;
 }
示例#6
0
  public static void main(String[] args) {

    AppGameContainer appgc;

    try {

      appgc = new AppGameContainer(new Main(gamename));

      appgc.setDisplayMode(xSize, ySize, false);

      int maxFPS = 60;

      appgc.setTargetFrameRate(maxFPS);

      appgc.setTargetFrameRate(60);

      appgc.start();

    } catch (SlickException e) {

      e.printStackTrace();
    }
  }