void initialize() { skin.getFont("default").getData().markupEnabled = true; for (int i = 0; i < 6; i++) trackButtons.add(new TextButton(i + "", skin, "toggle")); animationList.getSelection().setRequired(false); premultipliedCheckbox.setChecked(true); loopCheckbox.setChecked(true); scaleSlider.setValue(1); scaleSlider.setSnapToValues(new float[] {1, 1.5f, 2, 2.5f, 3, 3.5f}, 0.01f); mixSlider.setValue(0.3f); mixSlider.setSnapToValues(new float[] {1, 1.5f, 2, 2.5f, 3, 3.5f}, 0.1f); speedSlider.setValue(1); speedSlider.setSnapToValues(new float[] {0.5f, 0.75f, 1, 1.25f, 1.5f, 2, 2.5f}, 0.1f); alphaSlider.setValue(1); alphaSlider.setDisabled(true); window.setMovable(false); window.setResizable(false); window.setKeepWithinStage(false); window.setX(-3); window.setY(-2); window.getTitleLabel().setColor(new Color(0.76f, 1, 1, 1)); window.getTitleTable().add(openButton).space(3); window.getTitleTable().add(minimizeButton).width(20); skinScroll.setFadeScrollBars(false); animationScroll.setFadeScrollBars(false); }
@Override public void create() { // Gdx.gl.glClearColor( // background.rgb.getRed() / 255f, // background.rgb.getGreen() / 255f, // background.rgb.getBlue() / 255f, // background.rgb.getAlpha() / 255f); // Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // Gdx.graphics.setContinuousRendering(false); // Gdx.graphics.requestRendering(); cam = new OrthographicCamera(); batch = new SpriteBatch(); stage = new Stage(); skin = new Skin(Gdx.files.internal("data/uiskin.json")); input = new TextField("", skin); // can't use Table here since it will conflict with the Swing Table toolkit // this is why static is shit -.- labelInput = new Label("Sample Text:", skin); labelScale = new Label("Scale:", skin); scaleAmt = new Label("1.0", skin); labelInput.setHeight(input.getHeight()); labelInput.setPosition(10, Gdx.graphics.getHeight() - labelInput.getHeight() - 5); input.setPosition( labelInput.getX() + labelInput.getWidth() + 10, Gdx.graphics.getHeight() - input.getHeight() - 5); scaleSlider = new Slider(0, 3, 0.05f, false, skin); scaleSlider.setSnapToValues(new float[] {0.0f, 0.5f, 1.0f}, 0.05f); scaleSlider.addListener( new ChangeListener() { @Override public void changed(ChangeEvent arg0, Actor arg1) { scaleAmt.setText(String.format("%.2f", scaleSlider.getValue())); } }); scaleSlider.setValue(1.0f); scaleAmt.setText(String.format("%.2f", scaleSlider.getValue())); linearFiltering = new ToggleBox("Linear Filtering", skin); linearFiltering.addListener( new ClickListener() { public void clicked(InputEvent ev, float x, float y) { updateFiltering(); } }); scaleAmt.setHeight(scaleSlider.getHeight()); labelScale.setHeight(scaleSlider.getHeight()); labelScale.setPosition( input.getX() - 10 - labelScale.getWidth(), labelInput.getY() - labelInput.getHeight() - 5); scaleSlider.setPosition(input.getX(), input.getY() - input.getHeight() - 5); scaleAmt.setPosition(scaleSlider.getX() + scaleSlider.getWidth() + 5, scaleSlider.getY()); linearFiltering.setPosition(input.getX(), scaleSlider.getY() - scaleSlider.getHeight() - 10); Gdx.input.setInputProcessor(stage); stage.addActor(labelInput); stage.addActor(input); stage.addActor(labelScale); stage.addActor(scaleSlider); stage.addActor(scaleAmt); stage.addActor(linearFiltering); myButton = new TextButton("Blah", skin); }