예제 #1
0
  /**
   * The menu sequence that allows the user to select options.
   *
   * <p>
   *
   * <ul>
   *   <li>QuickStart (random character created for the player)
   *   <li>Create new character
   *   <li>Load a character
   *   <li>
   *   <li>Settings, including keybindings
   *   <li>Quit
   * </ul>
   */
  private void menuSelectionSequence() {

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    Input.poll();
    mouseEvents = Input.getMouseEvents();

    for (GLUIComponent b : menuSelectionButtons) {

      b.processMouseEvents(mouseEvents);
      b.update(0);
      b.renderGL();
    }

    try {
      menuTheme
          .getFont()
          .glDrawText(
              "\\c#FFFFFFUniQuest",
              (Main.SCREEN_WIDTH - menuTheme.getFont().getStringWidth("UniQuest")) / 2 + 2,
              50);
    } catch (InvalidEscapeSequenceException e) {
      e.printStackTrace();
    }

    Display.update();

    if (Display.isCloseRequested()) {
      Game.GAME_STATE = Game.GAME_STATE_QUIT;
      menu = false;
    }
  }
예제 #2
0
  private void keyConfigSequence() {

    while (loop) {

      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

      try {
        menuTheme
            .getFont()
            .glDrawText(
                "\\c#FFFFFFKey Bindings",
                (Main.SCREEN_WIDTH - menuTheme.getFont().getStringWidth("Key Bindings")) / 2 + 2,
                50);

      } catch (InvalidEscapeSequenceException e) {
        e.printStackTrace();
      }

      Input.poll();
      mouseEvents = Input.getMouseEvents();
      keyEvents = Input.getKeyEvents();

      try {
        drawKeyConfigText(margin, 75, 30);
      } catch (InvalidEscapeSequenceException e) {

      }

      for (GLUIComponent t : keyConfigTextField) {

        t.processKeyEvents(keyEvents);
        t.processMouseEvents(mouseEvents);
        t.update(0);
        t.renderGL();
      }

      Display.update();

      if (Display.isCloseRequested()) {
        Game.GAME_STATE = Game.GAME_STATE_QUIT;
        menu = false;
        loop = false;
      } else if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
        loop = false;
      }
    }

    for (GLUIComponent t : keyConfigTextField) {

      if (t instanceof GLTextField) {
        ((GLTextField) t).setText(((GLTextField) t).getText().toUpperCase());
        KeyBindings.valueOf(t.getContext().toString())
            .setUserKey(Keyboard.getKeyIndex(((GLTextField) t).getText()));
      }
    }
  }
예제 #3
0
  /** The menu sequence for changing the configuration settings */
  private void configSequence() {

    loop = true;

    while (loop) {

      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

      try {
        menuTheme
            .getFont()
            .glDrawText(
                "\\c#FFFFFFSettings",
                (Main.SCREEN_WIDTH - menuTheme.getFont().getStringWidth("Settings")) / 2 + 2,
                50);
      } catch (InvalidEscapeSequenceException e) {
        e.printStackTrace();
      }

      Input.poll();
      mouseEvents = Input.getMouseEvents();

      for (GLUIComponent b : configSequenceButtons) {

        b.processMouseEvents(mouseEvents);
        b.update(0);
        b.renderGL();
      }

      Display.update();

      if (Display.isCloseRequested()) {
        Game.GAME_STATE = Game.GAME_STATE_QUIT;
        menu = false;
        loop = false;
      } else if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
        loop = false;
      }
    }
  }