Java 类org.newdawn.slick.Input 实例源码

项目:BaseClient    文件:GeomAccuracyTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        System.exit(0);
    }

    if(key == Input.KEY_N) {
        curTest++;
        curTest %= NUMTESTS;
    }

    if(key == Input.KEY_C) {
        colorIndex++;

        colorIndex %= 4;
        setColors();
    }

    if(key == Input.KEY_T) {
        hideOverlay = !hideOverlay;
    }

}
项目:Progetto-C    文件:MouseOverArea.java   
/**
 * Create a new mouse over area
 * 
 * @param container
 *            The container displaying the mouse over area
 * @param image
 *            The normalImage to display
 * @param shape
 *            The shape defining the area of the mouse sensitive zone
 */
public MouseOverArea(GUIContext container, Image image, Shape shape) {
    super(container);

    area = shape;
    normalImage = image;
    currentImage = image;
    mouseOverImage = image;
    mouseDownImage = image;

    currentColor = normalColor;

    state = NORMAL;
    Input input = container.getInput();
    over = area.contains(input.getMouseX(), input.getMouseY());
    mouseDown = input.isMouseButtonDown(0);
    updateImage();
}
项目:trashjam2017    文件:TransformTest2.java   
/**
 * @see org.newdawn.slick.BasicGame#keyReleased(int, char)
 */
public void keyReleased(int key, char c) {
   if (key == Input.KEY_Q) {
      scaleUp = false;
   }
   if (key == Input.KEY_A) {
      scaleDown = false;
   }

   if( key == Input.KEY_LEFT) {
      moveLeft = false;
   }
   if( key == Input.KEY_UP ) {
      moveUp = false;
   }
   if( key == Input.KEY_RIGHT ) {
      moveRight = false;
   }
   if( key == Input.KEY_DOWN ) {
      moveDown = false;
   }
}
项目:BaseClient    文件:TransformTest2.java   
/**
 * @see org.newdawn.slick.BasicGame#keyReleased(int, char)
 */
public void keyReleased(int key, char c) {
   if (key == Input.KEY_Q) {
      scaleUp = false;
   }
   if (key == Input.KEY_A) {
      scaleDown = false;
   }

   if( key == Input.KEY_LEFT) {
      moveLeft = false;
   }
   if( key == Input.KEY_UP ) {
      moveUp = false;
   }
   if( key == Input.KEY_RIGHT ) {
      moveRight = false;
   }
   if( key == Input.KEY_DOWN ) {
      moveDown = false;
   }
}
项目:trashjam2017    文件:GeomAccuracyTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        System.exit(0);
    }

    if(key == Input.KEY_N) {
        curTest++;
        curTest %= NUMTESTS;
    }

    if(key == Input.KEY_C) {
        colorIndex++;

        colorIndex %= 4;
        setColors();
    }

    if(key == Input.KEY_T) {
        hideOverlay = !hideOverlay;
    }

}
项目:trashjam2017    文件:TestState3.java   
/**
 * @see org.newdawn.slick.state.BasicGameState#keyReleased(int, char)
 */
public void keyReleased(int key, char c) {
    if (key == Input.KEY_DOWN) {
        selected++;
        if (selected >= options.length) {
            selected = 0;
        }
    }
    if (key == Input.KEY_UP) {
        selected--;
        if (selected < 0) {
            selected = options.length - 1;
        }
    }
    if (key == Input.KEY_1) {
        game.enterState(TestState1.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
    }
    if (key == Input.KEY_2) {
        game.enterState(TestState2.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
    }
}
项目:trashjam2017    文件:InputTest.java   
/**
 * @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
 */
public void update(GameContainer container, int delta) {
       lshift = container.getInput().isKeyDown(Input.KEY_LSHIFT);
       rshift = container.getInput().isKeyDown(Input.KEY_RSHIFT);
       space = container.getInput().isKeyDown(Input.KEY_SPACE); 

    if (controllerLeft[0]) {
        x -= delta * 0.1f;
    }
    if (controllerRight[0]) {
        x += delta * 0.1f;
    }
    if (controllerUp[0]) {
        y -= delta * 0.1f;
    }
    if (controllerDown[0]) {
        y += delta * 0.1f;
    }
}
项目:trashjam2017    文件:MouseOverArea.java   
/**
 * Create a new mouse over area
 * 
 * @param container
 *            The container displaying the mouse over area
 * @param image
 *            The normalImage to display
 * @param shape
 *            The shape defining the area of the mouse sensitive zone
 */
public MouseOverArea(GUIContext container, Image image, Shape shape) {
    super(container);

    area = shape;
    normalImage = image;
    currentImage = image;
    mouseOverImage = image;
    mouseDownImage = image;

    currentColor = normalColor;

    state = NORMAL;
    Input input = container.getInput();
    over = area.contains(input.getMouseX(), input.getMouseY());
    mouseDown = input.isMouseButtonDown(0);
    updateImage();
}
项目:trashjam2017    文件:MainMenu.java   
@Override
public void update(GameContainer gc, StateBasedGame sbg, int i) throws SlickException {
    if (shouldToggleFullscreen) {
        shouldToggleFullscreen = false;
        boolean fs = !gc.isFullscreen();
        AppGameContainer agc = (AppGameContainer)gc;
        agc.setDisplayMode(fs ? agc.getScreenWidth() : Application.DISPLAY_WIDTH,
                           fs ? agc.getScreenHeight() : Application.DISPLAY_HEIGHT, fs);
    }
    if (gc.getInput().isKeyPressed(Input.KEY_ENTER)) {
        click.play(1.0f, CLICK_VOLUME);
        mainMenu.fade(1000, 0.0f, true);
        sbg.enterState(Application.GAME, new FadeOutTransition(Color.black, 1000), new EmptyTransition());
    }
    if (gc.getInput().isKeyPressed(Input.KEY_C)) {
        sbg.enterState(Application.CREDITS);
    }
}
项目:BaseClient    文件:BigImageTest.java   
/**
 * @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
 */
public void update(GameContainer container, int delta) throws SlickException {
    ang += delta * 0.1f;

    if (container.getInput().isKeyDown(Input.KEY_LEFT)) {
        x -= delta * 0.1f;
    }
    if (container.getInput().isKeyDown(Input.KEY_RIGHT)) {
        x += delta * 0.1f;
    }
    if (container.getInput().isKeyDown(Input.KEY_UP)) {
        y -= delta * 0.1f;
    }
    if (container.getInput().isKeyDown(Input.KEY_DOWN)) {
        y += delta * 0.1f;
    }
}
项目:BaseClient    文件:GUITest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        System.exit(0);
    }
    if (key == Input.KEY_F2) {
        app.setDefaultMouseCursor();
    }
    if (key == Input.KEY_F1) {
        if (app != null) {
            try {
                app.setDisplayMode(640,480,false);      
            } catch (SlickException e) {
                Log.error(e);
            }
        }
    }
}
项目:BaseClient    文件:TransformTest2.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
   if (key == Input.KEY_ESCAPE) {
      System.exit(0);
   }
   if (key == Input.KEY_Q) {
      scaleUp = true;
   }
   if (key == Input.KEY_A) {
      scaleDown = true;
   }

   if( key == Input.KEY_LEFT) {
      moveLeft = true;
   }
   if( key == Input.KEY_UP ) {
      moveUp = true;
   }
   if( key == Input.KEY_RIGHT ) {
      moveRight = true;
   }
   if( key == Input.KEY_DOWN ) {
      moveDown = true;
   }
}
项目:BaseClient    文件:TestState3.java   
/**
 * @see org.newdawn.slick.state.BasicGameState#keyReleased(int, char)
 */
public void keyReleased(int key, char c) {
    if (key == Input.KEY_DOWN) {
        selected++;
        if (selected >= options.length) {
            selected = 0;
        }
    }
    if (key == Input.KEY_UP) {
        selected--;
        if (selected < 0) {
            selected = options.length - 1;
        }
    }
    if (key == Input.KEY_1) {
        game.enterState(TestState1.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
    }
    if (key == Input.KEY_2) {
        game.enterState(TestState2.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
    }
}
项目:Generic-Zombie-Shooter-Redux    文件:GameState.java   
@Override
public void keyReleased(int key, char c) {
    if(key == Input.KEY_GRAVE) {
        console.setPauseTime(time);
        consoleOpen = !consoleOpen;
    }
    else if((key == Input.KEY_P) && !consoleOpen) {
        if(!paused) MusicPlayer.getInstance().pause();
        else MusicPlayer.getInstance().resume();
        paused = !paused;
    }
    else {
        if(consoleOpen) {
            console.keyReleased(key, c);
        } else {
            Globals.inputs.remove(key);
            Globals.released.add(key);
        }
    }
}
项目:Progetto-C    文件:TransformTest2.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
   if (key == Input.KEY_ESCAPE) {
      System.exit(0);
   }
   if (key == Input.KEY_Q) {
      scaleUp = true;
   }
   if (key == Input.KEY_A) {
      scaleDown = true;
   }

   if( key == Input.KEY_LEFT) {
      moveLeft = true;
   }
   if( key == Input.KEY_UP ) {
      moveUp = true;
   }
   if( key == Input.KEY_RIGHT ) {
      moveRight = true;
   }
   if( key == Input.KEY_DOWN ) {
      moveDown = true;
   }
}
项目:Progetto-C    文件:TransformTest2.java   
/**
 * @see org.newdawn.slick.BasicGame#keyReleased(int, char)
 */
public void keyReleased(int key, char c) {
   if (key == Input.KEY_Q) {
      scaleUp = false;
   }
   if (key == Input.KEY_A) {
      scaleDown = false;
   }

   if( key == Input.KEY_LEFT) {
      moveLeft = false;
   }
   if( key == Input.KEY_UP ) {
      moveUp = false;
   }
   if( key == Input.KEY_RIGHT ) {
      moveRight = false;
   }
   if( key == Input.KEY_DOWN ) {
      moveDown = false;
   }
}
项目:trashjam2017    文件:TransformTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        System.exit(0);
    }
    if (key == Input.KEY_Q) {
        scaleUp = true;
    }
    if (key == Input.KEY_A) {
        scaleDown = true;
    }
}
项目:BaseClient    文件:TrueTypeFontPerformanceTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        System.exit(0);
    }
    if (key == Input.KEY_SPACE) {
        visible = !visible;
    }
}
项目:trashjam2017    文件:ImageOutTest.java   
/**
 * @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
 */
public void update(GameContainer container, int delta) throws SlickException {
    fire.update(delta);

    if (container.getInput().isKeyPressed(Input.KEY_P)) {
        writeTo("ImageOutTest.png");
    }
    if (container.getInput().isKeyPressed(Input.KEY_J)) {
        writeTo("ImageOutTest.jpg");
    }
    if (container.getInput().isKeyPressed(Input.KEY_T)) {
        writeTo("ImageOutTest.tga");
    }
}
项目:BaseClient    文件:ImageTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_SPACE) {
        if (image == gif) {
            image = tga;
        } else {
            image = gif;
        }
    }
}
项目:trashjam2017    文件:TestBox.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    currentGame.keyPressed(key, c);

    if (key == Input.KEY_ENTER) {
        nextGame();
    }
}
项目:trashjam2017    文件:TrueTypeFontPerformanceTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        System.exit(0);
    }
    if (key == Input.KEY_SPACE) {
        visible = !visible;
    }
}
项目:trashjam2017    文件:TransitionTest.java   
/**
 * @see org.newdawn.slick.state.GameState#update(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame, int)
 */
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
    if (container.getInput().isKeyPressed(Input.KEY_SPACE)) {
        Transition[] pair = getNextTransitionPair();
        game.enterState(next, pair[0], pair[1]);
    }
}
项目:trashjam2017    文件:FontPerformanceTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        System.exit(0);
    }
    if (key == Input.KEY_SPACE) {
        visible = !visible;
    }
}
项目:trashjam2017    文件:NavMeshTest.java   
/**
 * Update data map etc
 */
public void update(GameContainer container, int delta)
        throws SlickException {
    if (container.getInput().isKeyPressed(Input.KEY_1)) {
        showLinks = !showLinks;
    }
    if (container.getInput().isKeyPressed(Input.KEY_2)) {
        showSpaces = !showSpaces;
    }
}
项目:BaseClient    文件:GradientImageTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_R) {
        rotating = !rotating;
    }
    if (key == Input.KEY_ESCAPE) {
        container.exit();
    }
}
项目:trashjam2017    文件:DuplicateEmitterTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        container.exit();
    }
    if (key == Input.KEY_K) {
        explosionEmitter.wrapUp();
    }
}
项目:BaseClient    文件:DuplicateEmitterTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        container.exit();
    }
    if (key == Input.KEY_K) {
        explosionEmitter.wrapUp();
    }
}
项目:BaseClient    文件:TransformTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyReleased(int, char)
 */
public void keyReleased(int key, char c) {
    if (key == Input.KEY_Q) {
        scaleUp = false;
    }
    if (key == Input.KEY_A) {
        scaleDown = false;
    }
}
项目:trashjam2017    文件:TestState2.java   
/**
 * @see org.newdawn.slick.state.BasicGameState#keyReleased(int, char)
 */
public void keyReleased(int key, char c) {
    if (key == Input.KEY_1) {
        game.enterState(TestState1.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
    }
    if (key == Input.KEY_3) {
        game.enterState(TestState3.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
    }
}
项目:Progetto-C    文件:Character.java   
private void setControlKeys() {
    if(this instanceof PacMan) {
        comands[0] = Input.KEY_UP;
        comands[1] = Input.KEY_DOWN;
        comands[2] = Input.KEY_LEFT;
        comands[3] = Input.KEY_RIGHT;
    }

    if(this instanceof Blinky) {
        comands[0] = Input.KEY_W;
        comands[1] = Input.KEY_S;
        comands[2] = Input.KEY_A;
        comands[3] = Input.KEY_D;
    }

    if(this instanceof Clyde) {
        comands[0] = Input.KEY_T;
        comands[1] = Input.KEY_G;
        comands[2] = Input.KEY_F;
        comands[3] = Input.KEY_H;
    }

    if(this instanceof Inky) {
        comands[0] = Input.KEY_I;
        comands[1] = Input.KEY_K;
        comands[2] = Input.KEY_J;
        comands[3] = Input.KEY_L;
    }

    if(this instanceof Pinky) {
        comands[0] = Input.KEY_5;
        comands[1] = Input.KEY_2;
        comands[2] = Input.KEY_1;
        comands[3] = Input.KEY_3;
    }

}
项目:trashjam2017    文件:InputTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        System.exit(0);
    }
    if (key == Input.KEY_F1) {
        if (app != null) {
            try {
                app.setDisplayMode(600, 600, false);
                app.reinit();
            } catch (Exception e) { Log.error(e); }
        }
    }
}
项目:trashjam2017    文件:KeyRepeatTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    count++;
    if (key == Input.KEY_SPACE) {
        if (input.isKeyRepeatEnabled()) {
            input.disableKeyRepeat();
        } else {
            input.enableKeyRepeat(300,100);
        }
    }
}
项目:trashjam2017    文件:GraphicsTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        System.exit(0);
    }
    if (key == Input.KEY_SPACE) {
        clip = !clip;
    }
}
项目:trashjam2017    文件:CanvasContainerTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_SPACE) {
        if (image == gif) {
            image = tga;
        } else {
            image = gif;
        }
    }
}
项目:BaseClient    文件:TransitionTest.java   
/**
 * @see org.newdawn.slick.state.GameState#update(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame, int)
 */
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
    if (container.getInput().isKeyPressed(Input.KEY_SPACE)) {
        Transition[] pair = getNextTransitionPair();
        game.enterState(next, pair[0], pair[1]);
    }
}
项目:trashjam2017    文件:ClipTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_1) {
        world = false;
        clip = false;
    }
    if (key == Input.KEY_2) {
        world = false;
        clip = true;
    }
    if (key == Input.KEY_3) {
        world = true;
        clip = false;
    }
}
项目:Progetto-C    文件:Character.java   
/**
 * If user press a new button, this method memorizes it.
 * @param input
 * @param n
 * @return 
 */
public boolean otherKeyPress(Input input, int n) {
    if ((input.isKeyDown(comands[1])) && checkBlockDown() && comands[1] != n)
            return true;
    else if ((input.isKeyDown(comands[0])) && checkBlockUp() && comands[0] != n)
            return true;
    else if ((input.isKeyDown(comands[2])) && checkBlockLeft() && comands[2] != n)
            return true;
    else if((input.isKeyDown(comands[3])) && checkBlockRight() && comands[3] != n)
            return true;
    else
        return false;
}
项目:trashjam2017    文件:AnimationTest.java   
/**
 * @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
 */
public void update(GameContainer container, int delta) {
    if (container.getInput().isKeyDown(Input.KEY_1)) {
        manual.update(delta);
    }
    if (start >= 0) {
        start -= delta;
    }
}
项目:trashjam2017    文件:AnimationTest.java   
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
    if (key == Input.KEY_ESCAPE) {
        container.exit();
    }
    if (key == Input.KEY_SPACE) {
        limited.restart();
    }
}