本文整理匯總了Java中com.strongjoshua.console.GUIConsole類的典型用法代碼示例。如果您正苦於以下問題:Java GUIConsole類的具體用法?Java GUIConsole怎麽用?Java GUIConsole使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GUIConsole類屬於com.strongjoshua.console包,在下文中一共展示了GUIConsole類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initConsole
import com.strongjoshua.console.GUIConsole; //導入依賴的package包/類
public void initConsole() {
if (!consoleEnabled) return;
if (consoleSkin == null) this.console = new GUIConsole();
else this.console = new GUIConsole(consoleSkin);
try {
Field f = GUIConsole.class.getDeclaredField("stage");
if (f != null) {
f.setAccessible(true);
Stage s = (Stage) f.get(this.console);
Argent.onResize.add((w, h) -> {
s.getViewport().update(w, h, true);
s.getCamera().viewportWidth = w;
s.getCamera().viewportHeight = h;
s.getCamera().update(true);
});
}
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
this.console.setSizePercent(100, 33);
this.console.setPositionPercent(0, 67);
this.console.setKeyID(Input.Keys.GRAVE);
this.console.setCommandExecutor(new CommandProcessor(this, this.console));
}
示例2: create
import com.strongjoshua.console.GUIConsole; //導入依賴的package包/類
@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("toggle 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());
}
示例3: setCtx
import com.strongjoshua.console.GUIConsole; //導入依賴的package包/類
private void setCtx() {
Ctx.project = new Project();
Ctx.assetManager = new EditorAssetManager();
EditorLogger.setConsole(new GUIConsole());
}