public static void setup(){ registerSerializer(Actor.class, new ActorSerializer()); registerSerializer(Scene.class, new SceneSerializer()); registerSerializer(ImageJson.class, new ImageJson()); registerSerializer(Label.class, new LabelSerializer()); registerSerializer(Button.class, new ButtonSerializer()); registerSerializer(TextButton.class, new TextButtonSerializer()); registerSerializer(Table.class, new TableSerializer()); registerSerializer(CheckBox.class, new CheckBoxSerializer()); registerSerializer(SelectBox.class, new SelectBoxSerializer()); registerSerializer(List.class, new ListSerializer()); registerSerializer(Slider.class, new SliderSerializer()); registerSerializer(TextField.class, new TextFieldSerializer()); registerSerializer(Touchpad.class, new TouchpadSerializer()); registerSerializer(Sprite.class, new SpriteSerializer()); registerSerializer(Dialog.class, new DialogSerializer()); registerSerializer(SplitPane.class, new SplitPaneSerializer()); registerSerializer(ScrollPane.class, new ScrollPaneSerializer()); registerSerializer(Stack.class, new StackSerializer()); registerSerializer(Tree.class, new TreeSerializer()); registerSerializer(Table.class, new TableSerializer()); registerSerializer(ButtonGroup.class, new ButtonGroupSerializer()); registerSerializer(HorizontalGroup.class, new HorizontalGroupSerializer()); registerSerializer(VerticalGroup.class, new VerticalGroupSerializer()); }
@Override public Actor createActor (Skin skin) { // Create the semaphore NonBlockingSemaphoreRepository.clear(); NonBlockingSemaphoreRepository.addSemaphore("dogSemaphore", 1); Reader reader = null; try { // Parse Buddy's tree reader = Gdx.files.internal("data/dogSemaphore.tree").reader(); BehaviorTreeParser<Dog> parser = new BehaviorTreeParser<Dog>(BehaviorTreeParser.DEBUG_HIGH); BehaviorTree<Dog> buddyTree = parser.parse(reader, new Dog("Buddy")); // Clone Buddy's tree for Snoopy BehaviorTree<Dog> snoopyTree = (BehaviorTree<Dog>)buddyTree.cloneTask(); snoopyTree.setObject(new Dog("Snoopy")); // Create split pane BehaviorTreeViewer<?> buddyTreeViewer = createTreeViewer(buddyTree.getObject().name, buddyTree, false, skin); BehaviorTreeViewer<?> snoopyTreeViewer = createTreeViewer(snoopyTree.getObject().name, snoopyTree, false, skin); return new SplitPane(new ScrollPane(buddyTreeViewer, skin), new ScrollPane(snoopyTreeViewer, skin), true, skin, "default-horizontal"); } finally { StreamUtils.closeQuietly(reader); } }
private void addNormalWidgets () { Skin skin = VisUI.getSkin(); Label label = new Label("Lorem \nipsum \ndolor \nsit \namet", skin); Label label2 = new Label("Consectetur \nadipiscing \nelit", skin); VisTable table = new VisTable(true); VisTable table2 = new VisTable(true); table.add(label); table2.add(label2); SplitPane splitPane = new SplitPane(table, table2, false, skin); add(splitPane).fill().expand(); }
public MainScreen() { Gdx.gl.glClearColor(.3f, .3f, .3f, 1); skin = new Skin(Gdx.files.internal("data/uiskin.json")); stage = new Stage(new ScreenViewport()); stage.setDebugAll(DEBUG_STAGE); // Create split pane List<String> testList = createTestList(); ScrollPane leftScrollPane = new ScrollPane(testList, skin); splitPane = new SplitPane(leftScrollPane, null, false, skin, "default-horizontal"); splitPane.setSplitAmount(Math.min((testList.getPrefWidth() + 10) / stage.getWidth(), splitPane.getSplit())); // Create layout Table t = new Table(skin); t.setFillParent(true); t.add(splitPane).colspan(3).grow(); t.row(); t.add(pauseButton = new PauseButton(skin)).width(90).left(); t.add(new FpsLabel("FPS: ", skin)).left(); t.add(testDescriptionLabel = new Label("", skin)).left(); stage.addActor(t); // Set selected test changeTest(0); }
public void resetProperties() { properties.clear(); if (clazz.equals(Button.class)) { newStyleProperties(ButtonStyle.class); } else if (clazz.equals(CheckBox.class)) { newStyleProperties(CheckBoxStyle.class); properties.get("checkboxOn").optional = false; properties.get("checkboxOff").optional = false; properties.get("font").optional = false; } else if (clazz.equals(ImageButton.class)) { newStyleProperties(ImageButtonStyle.class); } else if (clazz.equals(ImageTextButton.class)) { newStyleProperties(ImageTextButtonStyle.class); properties.get("font").optional = false; } else if (clazz.equals(Label.class)) { newStyleProperties(LabelStyle.class); properties.get("font").optional = false; } else if (clazz.equals(List.class)) { newStyleProperties(ListStyle.class); properties.get("font").optional = false; properties.get("fontColorSelected").optional = false; properties.get("fontColorUnselected").optional = false; properties.get("selection").optional = false; } else if (clazz.equals(ProgressBar.class)) { newStyleProperties(ProgressBarStyle.class); //Though specified as optional in the doc, there are bugs without "background" being mandatory properties.get("background").optional = false; } else if (clazz.equals(ScrollPane.class)) { newStyleProperties(ScrollPaneStyle.class); } else if (clazz.equals(SelectBox.class)) { newStyleProperties(SelectBoxStyle.class); properties.get("font").optional = false; properties.get("fontColor").optional = false; properties.get("scrollStyle").optional = false; properties.get("scrollStyle").value = "default"; properties.get("listStyle").optional = false; properties.get("listStyle").value = "default"; } else if (clazz.equals(Slider.class)) { newStyleProperties(SliderStyle.class); //Though specified as optional in the doc, there are bugs without "background" being mandatory properties.get("background").optional = false; } else if (clazz.equals(SplitPane.class)) { newStyleProperties(SplitPaneStyle.class); properties.get("handle").optional = false; } else if (clazz.equals(TextButton.class)) { newStyleProperties(TextButtonStyle.class); properties.get("font").optional = false; } else if (clazz.equals(TextField.class)) { newStyleProperties(TextFieldStyle.class); properties.get("font").optional = false; properties.get("fontColor").optional = false; } else if (clazz.equals(TextTooltip.class)) { newStyleProperties(TextTooltipStyle.class); properties.get("label").optional = false; properties.get("label").value = "default"; } else if (clazz.equals(Touchpad.class)) { newStyleProperties(TouchpadStyle.class); } else if (clazz.equals(Tree.class)) { newStyleProperties(TreeStyle.class); properties.get("plus").optional = false; properties.get("minus").optional = false; } else if (clazz.equals(Window.class)) { newStyleProperties(WindowStyle.class); properties.get("titleFont").optional = false; } }
@Override public Class<SplitPane> getHandledType() { return SplitPane.class; }
@Override public void process(final LmlParser parser, final LmlTag tag, final SplitPane actor, final String rawAttributeData) { actor.setSplitAmount(parser.parseFloat(rawAttributeData, actor)); }
@Override public void process(final LmlParser parser, final LmlTag tag, final SplitPane actor, final String rawAttributeData) { actor.setMaxSplitAmount(parser.parseFloat(rawAttributeData, actor)); }
@Override public void process(final LmlParser parser, final LmlTag tag, final SplitPane actor, final String rawAttributeData) { actor.setMinSplitAmount(parser.parseFloat(rawAttributeData, actor)); }
@Override protected Actor getNewInstanceOfActor(final LmlActorBuilder builder) { final AlignedLmlActorBuilder alignedBuilder = (AlignedLmlActorBuilder) builder; return new SplitPane(null, null, alignedBuilder.isVertical(), getSkin(builder), alignedBuilder.getStyleName()); }
/** @return casted widget. */ protected SplitPane getSplitPane() { return (SplitPane) getActor(); }
@Override public Group read(Json json, JsonValue jv, Class arg2) { SplitPane label = new SplitPane(null, null, false, Asset.skin); readGroup(jv, label); return label; }
public CategoryStatsScreen(MissingWords missingWords) { super(missingWords); font = new BitmapFont(Gdx.files.internal("fonts/title.fnt"), Gdx.files.internal("fonts/title.png"), false); fontList = new BitmapFont(Gdx.files.internal("fonts/listFont.fnt"), Gdx.files.internal("fonts/listFont.png"), false); /* Creamos el fondo de pantalla */ background = new Background(MissingWords.myManager.get("background.png", Texture.class)); stage.addActor(background); /* Creamos el bot�n de vuelta atr�s */ backButton = new BackButton(); backButton.addListener(new BackButtonListener(missingWords)); /* Creamos la tabla que ocupar� todo el stage (pantalla) */ stageTable = new Table(); stageTable.setFillParent(true); /* Creamos la etiqueta de la categor�a */ title = new Label(null, new LabelStyle(font, font.getColor())); /* Creamos el progreso de la categor�a */ progress = new Label(null, new LabelStyle(font, font.getColor())); /* Creamos la lista de palabras de la categor�a */ list = new List<String>(new ListStyle( fontList, fontList.getColor(), fontList.getColor(), new TextureRegionDrawable( new TextureRegion(MissingWords.myManager.get("selection.png", Texture.class))))); /* Creamos el scroll para la lista de palabras */ ScrollPane scroll = new ScrollPane(list, new ScrollPaneStyle(new TextureRegionDrawable( new TextureRegion(MissingWords.myManager.get("background.png", Texture.class))), null, null, new TextureRegionDrawable( new TextureRegion(MissingWords.myManager.get("verticalScroll.png", Texture.class))), new TextureRegionDrawable( new TextureRegion(MissingWords.myManager.get("squareBlue.png", Texture.class))))); /* Creamos la tabla izquierda del SplitPane */ left = new Table(); left.add(title).expand(); left.row(); left.add(progress).expand(); left.row(); left.add(backButton).align(Align.left).pad(10); /* Creamos la tabla derecha del SplitPane */ right = new Table(); right.add(scroll).fill().expand(); /* Creamos el SplitPane */ SplitPane split = new SplitPane(left, right, false, new SplitPaneStyle( new TextureRegionDrawable( new TextureRegion(MissingWords.myManager.get("split.png", Texture.class))))); stageTable.add(split).fill().expand(); // A�adimos el SplitPane a la stageTable stage.addActor(stageTable); // A�adimos la stageTable al stage }