コード例 #1
0
  @Override
  public void render(GameContainer arg0, StateBasedGame arg1, Graphics arg2) throws SlickException {

    startScreen.draw(0, 0);
    startGameButton.draw();
    optionsButton.draw();
    loreButton.draw();
    instructionsButton.draw();
  }
コード例 #2
0
  @Override
  public void update(GameContainer gc, StateBasedGame sbg, int arg2) throws SlickException {

    Input input = gc.getInput();

    int mouseX = input.getMouseX();
    int mouseY = input.getMouseY();

    if (input.isMousePressed((Input.MOUSE_LEFT_BUTTON))) {
      if (startGameButton.inSpan(mouseX, mouseY)) {
        changeState(sbg, levelSelectionState);
      } else if (optionsButton.inSpan(mouseX, mouseY)) {
        changeState(sbg, optionsState);
      } else if (loreButton.inSpan(mouseX, mouseY)) {
        changeState(sbg, loresState);
      } else if (instructionsButton.inSpan(mouseX, mouseY)) {
        changeState(sbg, instructionState);
      }
    }
  }