Search in sources :

Example 1 with ActorGradient

use of var3d.net.center.ActorGradient in project var3dframe by Var3D.

the class DialogTest method init.

@Override
public void init() {
    // 设置背景
    setBackground(new ActorGradient(400, 300, Color.CYAN, Color.CORAL));
    // 设置标题(对话框使用show方法的时候不能省略父对象参数)
    game.getLabel(R.strings.dialogTitle).touchOff().setPosition(getWidth() / 2, getHeight() - 20, Align.top).setColor(Color.RED).setStroke(Color.YELLOW).show(this);
    // 关闭按钮
    Button btn_close = game.getButton(R.image.pause_btn_bg).addClicAction().setPosition(getWidth() / 2, 50, Align.bottom).show(this);
    btn_close.add(game.getLabel("关闭").setColor(Color.RED).getActor());
    btn_close.addListener(new ClickListener() {

        public void clicked(InputEvent event, float x, float y) {
            game.removeDialog(DialogTest.this);
        // or game.removeTopDialog();
        // or game.removeAllDialog();
        }
    });
}
Also used : Button(com.badlogic.gdx.scenes.scene2d.ui.Button) ActorGradient(var3d.net.center.ActorGradient) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Aggregations

InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 Button (com.badlogic.gdx.scenes.scene2d.ui.Button)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 ActorGradient (var3d.net.center.ActorGradient)1