Exemplo n.º 1
0
  @Override
  public final void onStartScreen() {
    // output hello to the console
    console.output("Hello :)");
    // create the console commands class and attach it to the console
    ConsoleCommands consoleCommands = new ConsoleCommands(nifty, console);
    ConsoleCommand quitCommand = new QuitCommand();
    consoleCommands.registerCommand("quit", quitCommand);

    // finally enable command completion
    consoleCommands.enableCommandCompletion(true);
  }
  @Override
  public void bind(final Nifty nifty, final Screen screen) {
    this.nifty = nifty;
    this.screen = screen;

    this.consolePopup = nifty.createPopup("consolePopup");
    this.console = this.consolePopup.findNiftyControl("console", Console.class);

    consoleCommands = new ConsoleCommands(nifty, console);

    ConsoleCommand showCommand = new ShowCommand();

    consoleCommands.registerCommand("show DropDown", showCommand);

    NiftyCommand niftyCommand = new NiftyCommand();
    consoleCommands.registerCommand("nifty screen", niftyCommand);

    ConsoleCommand helpCommand = new HelpCommand();
    consoleCommands.registerCommand("help", helpCommand);

    ConsoleCommand clearCommand = new ClearCommand();
    consoleCommands.registerCommand("clear", clearCommand);

    ConsoleCommand exitCommand = new ExitCommand();
    consoleCommands.registerCommand("exit", exitCommand);

    // enable the nifty command line completion
    consoleCommands.enableCommandCompletion(true);

    // get all resolutions available into the resolutions drop down
    fillResolutionDropDown(screen);
  }