Java Code Examples for com.kotcrab.vis.ui.VisUI#load()

The following examples show how to use com.kotcrab.vis.ui.VisUI#load() . 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: TestFloatingGroup.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
@Override
public void create () {
	VisUI.load();

	stage = new Stage(new ScreenViewport());
	final Table root = new Table();
	root.setFillParent(true);
	stage.addActor(root);

	TestWindow window = new TestWindow();
	TestCollapsible collapsible = new TestCollapsible();
	window.setKeepWithinParent(true);
	window.setPosition(110, 110);
	collapsible.setKeepWithinParent(true);
	collapsible.setPosition(200, 200);

	FloatingGroup floatingGroup = new FloatingGroup(1000, 600);
	floatingGroup.addActor(window);
	floatingGroup.addActor(collapsible);

	root.debugAll();
	root.left().bottom();
	root.add(floatingGroup).padLeft(100).padBottom(100);

	Gdx.input.setInputProcessor(stage);
}
 
Example 2
Source File: CalibrationScreen.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Screen that only shows the chosen sprites and can be exited with an exit button
 * @param game
 */
public CalibrationScreen( Game game) {
    this.game = game;
    this.cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    if(this.game instanceof OverlayGame) {
        this.renderer = new Renderer(cam, ((OverlayGame) this.game).getSprites());
    }
    else {
        this.renderer = new Renderer(cam, new Sprites());
    }

    this.stage = new Stage();

    // Load UI for buttons if not already loaded
    if(!VisUI.isLoaded())
        VisUI.load();

    // Create back button
    createBackButton();
}
 
Example 3
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 4
Source File: MainMenuScreen.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Screen that only shows the chosen sprites and can be exited with an exit button
 * @param game
 */
public MainMenuScreen(Game game) {
    this.game = game;
    this.camera = new OrthographicCamera();
    this.viewport = new ExtendViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), this.camera);
    this.stage = new Stage(viewport);

    // Load UI for buttons if not already loaded
    if(!VisUI.isLoaded())
        VisUI.load();

    // Create buttons with listeners
    createButtons();
}
 
Example 5
Source File: Editor.java    From bladecoder-adventure-engine with Apache License 2.0 4 votes vote down vote up
@Override
public void create() {

	if (EditorLogger.debugMode()) {
		EngineLogger.setDebug();
	}

	Gdx.graphics.setWindowedMode(Math.max((int) (Gdx.graphics.getDisplayMode().width * 0.9), 1920 / 2),
			Math.max((int) (Gdx.graphics.getDisplayMode().height * 0.9), 1080 / 2));

	skin = new BladeSkin(Gdx.files.internal(SKIN));
	VisUI.load();
	FileChooser.setDefaultPrefsName("com.bladecoder.engineeditor.filechooser");

	/*** STAGE SETUP ***/
	stage = new Stage(new ScreenViewport());
	Gdx.input.setInputProcessor(stage);

	setCtx();

	Message.init(skin);

	scnEditor = new ScnEditor(skin);
	scnEditor.setBackground("background");
	skin.getFont("default-font").getData().markupEnabled = true;

	// RIGHT PANEL
	ScenePanel scenePanel = new ScenePanel(skin);
	ActorPanel actorPanel = new ActorPanel(skin);

	Table rightPanel = new Table(skin);
	rightPanel.top().left();
	rightPanel.add(actorPanel).expand().fill().left();
	rightPanel.setBackground("background");

	SplitPane splitPaneRight = new SplitPane(scnEditor, rightPanel, false, skin);

	splitPaneRight.setSplitAmount(0.75f);

	// LEFT PANEL
	ProjectPanel projectPanel = new ProjectPanel(skin);
	Image img = new Image(Ctx.assetManager.getIcon("title"));
	img.setScaling(Scaling.none);
	img.setAlign(Align.left);

	Table leftPanel = new Table(skin);
	leftPanel.top().left().padLeft(10);
	leftPanel.add(img).expand().fill().padBottom(20).padTop(20).padLeft(0).left();
	leftPanel.row();
	leftPanel.add(new ProjectToolbar(skin)).expandX().fill().left();
	leftPanel.row();
	leftPanel.add(projectPanel).expand().fill().left();
	leftPanel.row();
	leftPanel.add(scenePanel).expand().fill().left();
	leftPanel.setBackground("background");

	SplitPane splitPaneLeft = new SplitPane(leftPanel, splitPaneRight, false, skin);
	splitPaneLeft.setFillParent(true);
	splitPaneLeft.setSplitAmount(0.25f);
	stage.addActor(splitPaneLeft);

	// LOAD LAST OPEN PROJECT
	String lastProject = Ctx.project.getEditorConfig().getProperty(Project.LAST_PROJECT_PROP, "");
	final File lastProjectFile = new File(lastProject);

	if (!lastProject.isEmpty() && lastProjectFile.exists()) {
		EditorLogger.debug("Loading previous project: " + lastProject);

		try {
			EditorUtils.checkVersionAndLoadProject(lastProjectFile, stage, skin);
		} catch (Exception e) {
			EditorLogger.error("Error loading previous project.", e);
			Ctx.project.closeProject();
		}
	}

	stage.setScrollFocus(scnEditor.getScnWidget());
	stage.setKeyboardFocus(scnEditor.getScnWidget());

	// TooltipManager.getInstance().instant();
	TooltipManager.getInstance().initialTime = 0.2f;
	TooltipManager.getInstance().hideAll();
	TooltipManager.getInstance().subsequentTime = 0.2f;
}