com.strongjoshua.console.GUIConsole Java Examples

The following examples show how to use com.strongjoshua.console.GUIConsole. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayScreen.java    From xibalba with MIT License 5 votes vote down vote up
/**
 * Play Screen.
 *
 * @param main Instance of Main class
 */
public PlayScreen(Main main) {
  glProfiler = new GLProfiler(Gdx.graphics);

  autoTimer = 0;
  keyHoldTimerDelay = 0;
  keyHoldTimer = 0;
  batch = new SpriteBatch();

  // Setup camera;
  OrthographicCamera worldCamera = new OrthographicCamera();

  // Setup renderers
  worldRenderer = new WorldRenderer(worldCamera, batch);
  hudRenderer = new HudRenderer(main, batch);

  // Debug console
  console = new GUIConsole(Main.skin, false);
  console.setCommandExecutor(new ConsoleCommandExecutor());
  console.setSizePercent(100, 50);

  // Setup input
  multiplexer = new InputMultiplexer();
  playerInput = new PlayerInput(worldCamera);
  multiplexer.addProcessor(hudRenderer.stage);
  multiplexer.addProcessor(playerInput);

  // Player attributes & their god
  playerAttributes = ComponentMappers.attributes.get(WorldManager.player);
  god = ComponentMappers.god.get(WorldManager.god);

  // Generate all dijkstra maps
  WorldManager.world.getCurrentMap().dijkstra.updateAll();

  // Change state to playing
  WorldManager.state = WorldManager.State.PLAYING;
}
 
Example #2
Source File: VisUITest.java    From libgdx-inGameConsole with Apache License 2.0 5 votes vote down vote up
@Override public void create () {
	VisUI.load();
	Gdx.gl.glClearColor(0, 0, 0, 1);
	console = new GUIConsole(VisUI.getSkin(), false, 0, VisWindow.class, VisTable.class, "default-pane", TextField.class,
		VisTextButton.class, VisLabel.class, VisScrollPane.class);
	console.setCommandExecutor(new MyCommandExecutor());
	console.setSizePercent(100, 100);
	console.setPosition(0, 0);
	console.setVisible(true);
	console.enableSubmitButton(true);
	console.resetInputProcessing();
}
 
Example #3
Source File: StageTest.java    From libgdx-inGameConsole with Apache License 2.0 5 votes vote down vote up
@Override public void create () {
	stage = new Stage();
	Gdx.input.setInputProcessor(stage);

	Skin skin = new Skin(Gdx.files.classpath("tests/test_skin/uiskin.json"));
	console = new GUIConsole(skin);
	console.setCommandExecutor(new MyCommandExecutor());
	console.setSizePercent(100, 50);

	stage.addListener(new InputListener() {
		@Override public boolean keyDown (InputEvent event, int keycode) {
			if (keycode == Input.Keys.F) {
				blink();
				return true;
			} else if (keycode == Input.Keys.TAB) {
				console.select();
				return true;
			} else if (keycode == Input.Keys.D) {
				System.out.println("Console " + (console.isDisabled() ? "enabled" : "disabled"));
				console.setDisabled(!console.isDisabled());
				return true;
			}
			return false;
		}
	});

	image = new Image(new Texture(Gdx.files.classpath("tests/badlogic" + "" + ".jpg")));
	image.setScale(.5f);
	stage.addActor(image);

	selectLabel = new Label("Select", skin);
	deselectLabel = new Label("Deselect", skin);
	stage.addActor(selectLabel);
	stage.addActor(deselectLabel);
	int padding = 25;
	selectLabel.setPosition(Gdx.graphics.getWidth() - selectLabel.getWidth() - deselectLabel.getWidth() - 2 * padding,
		selectLabel.getHeight());
	deselectLabel.setPosition(Gdx.graphics.getWidth() - deselectLabel.getWidth() - padding, deselectLabel.getHeight());
}
 
Example #4
Source File: Editor.java    From bladecoder-adventure-engine with Apache License 2.0 4 votes vote down vote up
private void setCtx() {
	Ctx.project = new Project();
	Ctx.assetManager = new EditorAssetManager();

	EditorLogger.setConsole(new GUIConsole());
}