List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Label getText
public StringBuilder getText()
From source file:ateamproject.kezuino.com.github.render.screens.CreditsScreen.java
private void placeLabels() { float lastHorizontalPositionTitel = 0; for (Label label : titelLabels) { label.setPosition(lastHorizontalPositionTitel, stage.getHeight() - this.titelSpacingVertical); label.setFontScale(3);/*from w w w. j ava2 s . c o m*/ label.setStyle(titelFont); stage.addActor(label); lastHorizontalPositionTitel += this.titelSpacingHorizontal; } int lineNumber = 1; float lastHorizontalPositionContent = 0; for (Label label : contentLabels) { label.setPosition(lastHorizontalPositionContent, stage.getHeight() - 60 - (this.contentSpacingVertical * lineNumber)); label.setStyle(contentFont); label.setColor(Color.BLACK); if (!label.getText().toString().equals(",")) { stage.addActor(label); lastHorizontalPositionContent += this.contentSpacingHorizontal; } else { lineNumber++; lastHorizontalPositionContent = 0; } } }
From source file:es.eucm.ead.editor.control.actions.editor.AddLabel.java
License:Open Source License
private void addText(Label label, boolean keepStyle) { Skin skin = controller.getEditorGameAssets().getSkin(); if (!keepStyle) { setDefaultFont(label);// w w w . ja v a 2 s . c o m } LabelStyle labelStyle = skin.get(label.getStyle(), LabelStyle.class); glyphLayout.setText(labelStyle.font, label.getText()); ModelEntity textLabel = Q.createCenteredEntity(glyphLayout.width * .5f, glyphLayout.height * .5f, label); controller.action(AddSceneElement.class, textLabel); }
From source file:es.eucm.ead.editor.control.actions.model.ChangeSelectionText.java
License:Open Source License
@Override public Command perform(Object... args) { ModelEntity element = (ModelEntity) controller.getModel().getSelection().getSingle(Selection.SCENE_ELEMENT); Label label = Q.getComponent(element, Label.class); Skin skin = controller.getEditorGameAssets().getSkin(); LabelStyle newLabelStyle = skin.get(label.getStyle(), LabelStyle.class); String newText = label.getText(); CompositeCommand command = new CompositeCommand(); if (args.length == 1) { if (args[0] instanceof Color) { Color color = (Color) args[0]; es.eucm.ead.schema.data.Color schemaColor = new es.eucm.ead.schema.data.Color(); schemaColor.setR(color.r);/*from ww w .jav a 2s. com*/ schemaColor.setG(color.g); schemaColor.setB(color.b); schemaColor.setA(color.a); return new FieldCommand(label, FieldName.COLOR, schemaColor); } else { newText = args[0].toString(); command.addCommand(new FieldCommand(label, FieldName.TEXT, newText)); } } else { if ((Boolean) args[1]) { newText = args[0].toString(); command.addCommand(new FieldCommand(label, FieldName.TEXT, newText)); } else { newLabelStyle = skin.get(args[0].toString(), LabelStyle.class); command.addCommand(new FieldCommand(label, FieldName.STYLE, args[0].toString())); } } // Actualize origin glyphLayout.setText(newLabelStyle.font, newText); command.addCommand(new FieldCommand(element, FieldName.ORIGIN_X, glyphLayout.width * 0.5f)); command.addCommand(new FieldCommand(element, FieldName.ORIGIN_Y, glyphLayout.height * 0.5f)); return command; }
From source file:es.eucm.ead.engine.processors.controls.LabelProcessor.java
License:Open Source License
@Override public Component getComponent(Label component) { Skin skin = gameAssets.getSkin();// w w w . j ava 2s.c o m LabelComponent label = gameLoop.createComponent(LabelComponent.class); label.setVariablesManager(variablesManager); LabelStyle style = skin.get(component.getStyle(), LabelStyle.class); LabelStyle styleCopy = new LabelStyle(style); Color color = component.getColor(); if (color != null) { styleCopy.fontColor.set(color.getR(), color.getG(), color.getB(), color.getA()); } label.setControl(new com.badlogic.gdx.scenes.scene2d.ui.Label("", styleCopy)); label.getControl().setAlignment(Align.center); label.setText(gameAssets.getI18N().m(component.getText())); I18nTextComponent textComponent = gameLoop.createComponent(I18nTextComponent.class); textComponent.setI18nKey(component.getText()); textComponent.setTextSetter(label); return new MultiComponent(label, textComponent); }