Example usage for com.badlogic.gdx.scenes.scene2d.ui ScrollPane ScrollPane

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ScrollPane ScrollPane

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui ScrollPane ScrollPane.

Prototype

public ScrollPane(Actor widget, ScrollPaneStyle style) 

Source Link

Usage

From source file:it.alcacoop.backgammon.layers.DiceStatsScreen.java

License:Open Source License

public void initTable() {
    StatManager mgr = StatManager.getInstance();
    table.clear();//w w w . ja va 2  s.  com

    float w1 = stage.getWidth() * 0.30f;
    float w2 = stage.getWidth() * 0.13f;

    table.setWidth(stage.getWidth() * 0.9f);
    table.setHeight(stage.getHeight() * 0.9f);
    table.setX((stage.getWidth() - table.getWidth()) / 2);
    table.setY((stage.getHeight() - table.getHeight()) / 2);

    table.add(new Label("DICE STATISTICS", GnuBackgammon.skin));

    table.row();
    table.add().fill().expand().height(stage.getHeight() / 40);

    Table controls = new Table();
    if (GnuBackgammon.Instance.ss != 2)
        controls.setBackground(GnuBackgammon.skin.getDrawable("list"));
    controls.row();
    controls.add(new Label("SELECT LEVEL:", GnuBackgammon.skin)).fill();
    controls.add(sb).fill().padLeft(stage.getWidth() / 85);
    if (GnuBackgammon.Instance.ss != 2) {
        Label note = new Label("For less than 2000 rolls data have\n large variation from expected values",
                GnuBackgammon.skin);
        note.setAlignment(Align.right, Align.right);
        controls.add(note).expand().fill();
    }

    table.row();
    table.add(controls).left().fill().expand();

    Table data_table = new Table();
    data_table.row().width(w1 + 3 * w2);

    Table t0 = new Table();
    t0.add().expand().width(w1);
    Label l = new Label("YOU", GnuBackgammon.skin);
    l.setAlignment(0, 1);
    t0.add(l).uniform().center().width(w2);
    t0.add(new Label("CPU", GnuBackgammon.skin)).uniform().center();
    t0.add(new Label("EXPT", GnuBackgammon.skin)).uniform().center();
    data_table.add(t0).fill();

    data_table.row();
    data_table.add(new Label("GENERAL", GnuBackgammon.skin, "even")).left().padBottom(stage.getHeight() / 50);
    Table t1 = new Table();
    t1.setBackground(GnuBackgammon.skin.getDrawable("even"));
    for (int i = 0; i < 4; i++) {
        t1.row();
        t1.add().expand().width(w1 * 0.15f);
        t1.add(new Label(dataStrings[i][0], GnuBackgammon.skin)).expand().width(w1 * 0.85f);
        Label l1 = new Label(mgr.getRollStat(i, statLevel, 0), GnuBackgammon.skin);
        l1.setAlignment(0, 1);
        t1.add(l1).uniform().center().width(w2);
        t1.add(new Label(mgr.getRollStat(i, statLevel, 1), GnuBackgammon.skin)).uniform().center();
        t1.add(new Label(dataStrings[i][1], GnuBackgammon.skin)).uniform().center();
    }
    data_table.row();
    data_table.add(t1).colspan(4).fill();

    data_table.row().padTop(stage.getHeight() / 20);
    data_table.add(new Label("DOUBLE IN A ROW", GnuBackgammon.skin, "even")).left()
            .padBottom(stage.getHeight() / 50);
    Table t2 = new Table();
    t2.setBackground(GnuBackgammon.skin.getDrawable("even"));
    for (int i = 4; i < 8; i++) {
        t2.row();
        t2.add().expand().width(w1 * 0.15f);
        t2.add(new Label(dataStrings[i][0], GnuBackgammon.skin)).expand().width(w1 * 0.85f);
        Label l1 = new Label(mgr.getRollStat(i, statLevel, 0), GnuBackgammon.skin);
        l1.setAlignment(0, 1);
        t2.add(l1).uniform().center().width(w2);
        t2.add(new Label(mgr.getRollStat(i, statLevel, 1), GnuBackgammon.skin)).uniform().center();
        t2.add(new Label(dataStrings[i][1], GnuBackgammon.skin)).uniform().center();
    }
    data_table.row();
    data_table.add(t2).colspan(4).fill();

    data_table.row().padTop(stage.getHeight() / 20);
    data_table.add(new Label("ENTER AGAINST", GnuBackgammon.skin, "even")).left()
            .padBottom(stage.getHeight() / 50);
    Table t3 = new Table();
    t3.setBackground(GnuBackgammon.skin.getDrawable("even"));
    for (int i = 8; i < dataStrings.length; i++) {
        t3.row();
        t3.add().expand().width(w1 * 0.15f);
        t3.add(new Label(dataStrings[i][0], GnuBackgammon.skin)).expand().width(w1 * 0.85f);
        Label l1 = new Label(mgr.getRollStat(i, statLevel, 0), GnuBackgammon.skin);
        l1.setAlignment(0, 1);
        t3.add(l1).uniform().center().width(w2);
        t3.add(new Label(mgr.getRollStat(i, statLevel, 1), GnuBackgammon.skin)).uniform().center();
        t3.add(new Label(dataStrings[i][1], GnuBackgammon.skin)).uniform().center();
    }
    data_table.row();
    data_table.add(t3).colspan(4).fill();

    ScrollPane sp = new ScrollPane(data_table, GnuBackgammon.skin);
    sp.setFadeScrollBars(false);

    Table wrapper = new Table();
    wrapper.setBackground(GnuBackgammon.skin.getDrawable("list"));
    wrapper.add().expand().fill();
    wrapper.add(sp).expand().fill();
    wrapper.add().expand().fill();
    wrapper.addActor(resetBtn);
    resetBtn.setPosition(table.getWidth() - 1.8f * resetBtn.getWidth(), resetBtn.getHeight() / 2);

    table.row();
    table.add(wrapper).expand().fill();

    table.row();
    table.add().fill().expand().height(stage.getHeight() / 40);

    table.row();
    table.add(backBtn).width(stage.getWidth() / 4).fill().expand().height(stage.getHeight() / 8);
}

From source file:it.alcacoop.backgammon.layers.FibsScreen.java

License:Open Source License

public FibsScreen() {
    me = new Player();
    me.parsePlayer(username + " - - 1 0 1500 1 0 1 1 - - -");

    fibsPlayers = Collections.synchronizedMap(new TreeMap<String, Player>());
    fibsInvitations = Collections.synchronizedMap(new HashMap<String, Integer>());
    evenbg = GnuBackgammon.skin.getDrawable("even");
    iSended = GnuBackgammon.atlas.findRegion("isended");
    iReceived = GnuBackgammon.atlas.findRegion("ireceived");

    stage.addListener(new InputListener() {
        @Override/*from  ww  w . j  a  v a 2s  .c om*/
        public boolean keyDown(InputEvent event, int keycode) {
            if (Gdx.input.isKeyPressed(Keys.BACK) || Gdx.input.isKeyPressed(Keys.ESCAPE)) {
                GnuBackgammon.fsm.processEvent(Events.BUTTON_CLICKED, "BACK");
            }
            return super.keyDown(event, keycode);
        }
    });

    ClickListener cl = new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.fsm.processEvent(Events.BUTTON_CLICKED,
                    ((TextButton) event.getListenerActor()).getText().toString().toUpperCase());
        };
    };

    inviteClicked = new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            String s = ((Label) event.getListenerActor()).getText().toString().trim();
            if ((fibsInvitations.containsKey(s)) && ((int) fibsInvitations.get(s) > 0)) {
                lastInvite = s;
                UIDialog.getInviteClickedDialog(s);
            }
        };
    };

    rowClicked = new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            String s = ((Label) event.getListenerActor()).getText().toString();
            String arg[] = s.split(" ");
            String u = arg[1].toLowerCase();
            Player p = null;
            if (fibsPlayers.containsKey(u))
                p = fibsPlayers.get(u);

            if (p.isPlaying())
                UIDialog.getFlashDialog(Events.NOOP,
                        "User \"" + p.getName() + "\" is playing.. You can't invite him");
            else if (!p.isReady())
                UIDialog.getFlashDialog(Events.NOOP,
                        "User \"" + p.getName() + "\" is busy.. You can't invite him");
            else {
                lastInvite = p.getName();
                UIDialog.getYesNoDialog(Events.FIBS_INVITE_SENDED,
                        "Really invite \"" + p.getName() + "\" to new 1 point match?");
            }
        };
    };

    LLastLogin = new Label("", GnuBackgammon.skin);

    evenLs = GnuBackgammon.skin.get("even", LabelStyle.class);

    width = stage.getWidth() * 0.95f;
    height = stage.getHeight() * 0.95f;

    ScrollPaneStyle sps = GnuBackgammon.skin.get("lists", ScrollPaneStyle.class);
    onlineList = new ScrollPane(new Table(), sps);
    onlineList.setFadeScrollBars(false);
    onlineList.setForceOverscroll(false, false);
    onlineList.setOverscroll(false, false);

    invitationList = new ScrollPane(new Table(), sps);
    invitationList.setFadeScrollBars(false);
    invitationList.setForceOverscroll(false, false);
    invitationList.setOverscroll(false, false);

    Table table = new Table();
    //Drawable d = GnuBackgammon.skin.getDrawable("default-window");
    table.setFillParent(true);

    ClickListener toggleStatus = new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.commandDispatcher.send("toggle ready");
            me.toggleReady();
            GnuBackgammon.Instance.commandDispatcher.send("who " + username);
        };
    };

    Table title = new Table();
    title.addListener(toggleStatus);

    //title.setBackground(d);
    title.add(me.getStatusImage()).left();
    title.add(me.getLabel()).left();
    title.add(LLastLogin).expandX().right();

    table.add(title).colspan(2).expand();

    table.row();
    table.add().colspan(2).expand().fill();

    l1 = new Label("ONLINE USERS", GnuBackgammon.skin);
    l1.setAlignment(Align.top);
    l1.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (!GnuBackgammon.Instance.fibsScreen.showWho) {
                GnuBackgammon.Instance.fibsScreen.showWho = true;
                GnuBackgammon.Instance.snd.playMoveStart();
                Table t = new Table();
                t.add(new Label("Loading list...", GnuBackgammon.skin));
                onlineList.setWidget(t);
                GnuBackgammon.Instance.commandDispatcher.send("who");
            }
        }
    });

    Table t1 = new Table();
    t1.setBackground(GnuBackgammon.skin.getDrawable("list"));
    t1.add(l1).center().height(height * 0.075f);
    t1.row();
    t1.add(onlineList).fill().left().top().height(height * 0.55f).width(width * 0.52f);

    Label l2 = new Label("INVITATIONS", GnuBackgammon.skin);
    l2.setAlignment(Align.top);
    Table t2 = new Table();
    t2.setBackground(GnuBackgammon.skin.getDrawable("list"));
    t2.add(l2).center().height(height * 0.075f);
    t2.row();
    t2.add(invitationList).fill().left().height(height * 0.55f).width(width * 0.32f);

    table.row();
    table.add(t1);
    table.add(t2);

    table.row();
    table.add().fill().expand().colspan(2);

    TextButton back = new TextButton("BACK", GnuBackgammon.skin);
    back.addListener(cl);
    table.row();
    Table bt = new Table();
    bt.add(back).width(width * 0.3f).fill().expand();
    table.add(bt).colspan(2).height(height * 0.11f);

    g = new Group();
    g.setWidth(width);
    g.setHeight(height);
    g.addActor(table);

    g.setX((stage.getWidth() - g.getWidth()) / 2);
    g.setY((stage.getHeight() - g.getHeight()) / 2);

    stage.addActor(g);
}

From source file:it.alcacoop.backgammon.layers.TwoPlayersScreen.java

License:Open Source License

public TwoPlayersScreen() {
    ClickListener cl = new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            String s = ((TextButton) event.getListenerActor()).getText().toString().toUpperCase();
            if (!s.equals("BACK"))
                s += variant;/*from   ww  w  . j  av  a 2  s.  c om*/
            GnuBackgammon.fsm.processEvent(Events.BUTTON_CLICKED, s);
        };
    };

    llocal = new Label("", GnuBackgammon.skin);
    llocal.setWrap(true);

    String sl = "LOCAL\n\n" + "Play against human player on the same device\n"
            + "As on single player mode, you can choose from 1 to 15 points match,"
            + "with or without cube, an between two variant: " + "\n1. Backgammon" + "\n2. Nackgammon";
    llocal.setText(sl);

    ltiga = new Label("", GnuBackgammon.skin);
    ltiga.setWrap(true);
    String st = "TIGERGAMMON\n\n"
            + "TigerGammon is our favorite backgammon server. It has a high performance and many features.\n\n"
            + "You will find human players from all over the world playing on TigerGammon. And you also will "
            + "find bots so that you will always be able to find an opponent on your favorite level of skill.\n"
            + "For more information see http://tigergammon.com.\n\n"
            + "To play on TigerGammon you have to chose a username and password. Please do not forget your password. "
            + "There is currently no way to retrieve this information.\n"
            + "Validation of the account is NOT neccessary.";

    /**
     * OLD TEXT
     * "TigerGammon is just another backgammon server like FIBS (First internet Backgammon Server).\n" +
     * "TigerGammon wants to keep the institution FIBS alive. " +
     * "TigerGammon works just like FIBS. Over time you will see features " +
     * "that exceed, what you can see on FIBS\n\n" +
     * "ANDREAS HAUSMANN features TigerGammon. He is another Fibster discontent " +
     * "with the flaws of FIBS just like so many others.\n\n" +
     * "Like FIBS, TigerGammon needs a username/password account.\nNOTE: FIBS account is " +
     * "not compatible with TigerGammon account - You must create another one, with different ranking\n\n" +
     * "Please do not forget your password. There is currently no way " +
     * "for the TigerGammon administrator to retrieve this information. If you " +
     * "forget your password then you must start again under a new username.";
     **/
    ltiga.setText(st);

    lfibs = new Label("", GnuBackgammon.skin);
    lfibs.setWrap(true);
    String sf = "FIBS\n\n" + "FIBS is the First Internet Backgammon Server, "
            + "it allows Internet users to play backgammon in real-time against "
            + "real people (and even some bots). There are players of every "
            + "conceivable ability logging onto FIBS, from absolute beginners "
            + "to serious backgammon champion contenders. \n\n"
            + "NOTE: At the moment FIBS needs validation for new users, so "
            + "you can't create accounts within Backgammon Mobile; "
            + "more info available at 'http://fibs.com'\n\n"
            + "Alternatively you can get a try on our primary choice: TigerGammon!";
    lfibs.setText(sf);

    lplay = new Label("", GnuBackgammon.skin);
    lplay.setWrap(true);
    String sg = "GOOGLE PLAY GAMES\n\n" + "Play against your Google+ friends or random opponent\n\n"
            + " - Invite your Google+ friends on involving matches\n"
            + " - Keep track of your progress, trying to unlock all achievements\n"
            + " - Share your scores on global leaderboards, with daily, weekly, and all-time lists\n"
            + " - Save your settings and game progress on the cloud, and share it among all your devices\n"
            + " - Share the right things with the right people, using Google+ circles!";
    lplay.setText(sg);

    stage.addListener(new InputListener() {
        @Override
        public boolean keyDown(InputEvent event, int keycode) {
            if (Gdx.input.isKeyPressed(Keys.BACK) || Gdx.input.isKeyPressed(Keys.ESCAPE)) {
                if (UIDialog.isOpened())
                    return false;
                GnuBackgammon.fsm.processEvent(Events.BUTTON_CLICKED, "BACK");
            }
            return super.keyDown(event, keycode);
        }
    });

    type = new FixedButtonGroup();

    Label titleLabel = new Label("TWO PLAYERS SETTINGS", GnuBackgammon.skin);

    float height = stage.getHeight() / 8.5f;
    float pad = 0;

    table = new Table();
    table.setWidth(stage.getWidth() * 0.9f);
    table.setHeight(stage.getHeight() * 0.9f);
    table.setX((stage.getWidth() - table.getWidth()) / 2);
    table.setY((stage.getHeight() - table.getHeight()) / 2);

    TextButton play = new TextButton("PLAY", GnuBackgammon.skin);
    play.addListener(cl);
    TextButton back = new TextButton("BACK", GnuBackgammon.skin);
    back.addListener(cl);

    TextButtonStyle ts = GnuBackgammon.skin.get("toggle", TextButtonStyle.class);
    IconButton local = new IconButton("Local", GnuBackgammon.atlas.findRegion("dp"), ts);
    IconButton fibs = new IconButton("FIBS", GnuBackgammon.atlas.findRegion("mpl"), ts);
    IconButton tiga = new IconButton("TigerGammon", GnuBackgammon.atlas.findRegion("mpl"), ts);
    IconButton gplay = new IconButton("Google Play Games", GnuBackgammon.atlas.findRegion("gpl"), ts);
    type.add(local);
    type.add(fibs);
    type.add(tiga);
    type.add(gplay);

    local.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            Table text = new Table();
            text.add(llocal).left().top().expandX().fillX();
            text.row();
            text.add().fill().expand();
            sp.setWidget(text);
            variant = 0;
            GnuBackgammon.Instance.server = "";
        }
    });

    fibs.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            Table text = new Table();
            text.add(lfibs).left().top().expand().fill();
            text.row();
            text.add().fill().expand();
            sp.setWidget(text);
            variant = 1;
            GnuBackgammon.Instance.server = "fibs.com";
        }
    });

    tiga.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            Table text = new Table();
            text.add(ltiga).left().top().expand().fill();
            text.row();
            text.add().fill().expand();
            sp.setWidget(text);
            variant = 2;
            GnuBackgammon.Instance.server = "ti-ga.com";
        }
    });

    gplay.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            Table text = new Table();
            text.add(lplay).left().top().expand().fill();
            text.row();
            text.add().fill().expand();
            sp.setWidget(text);
            variant = 3;
        }
    });

    table.add(titleLabel).colspan(7);

    table.row();
    table.add().fill().expandX().colspan(7).height(height / 2);

    Table t1 = new Table();

    t1.add().expandX().fill().height(height / 10);
    t1.row();
    t1.add(local).fillX().expandX().height(height).padRight(pad);
    t1.row();
    t1.add().expandX().fill().height(height / 10);

    t1.row();
    t1.add(gplay).fillX().expandX().height(height).padRight(pad);
    t1.row();
    t1.add().expandX().fill().height(height / 10);

    t1.row();
    t1.add(tiga).fillX().expandX().height(height).padRight(pad);
    t1.row();
    t1.add().expandX().fill().height(height / 10);

    t1.row();
    t1.add(fibs).fillX().expandX().height(height).padRight(pad);
    t1.row();
    t1.add().expand().fill();

    Table text = new Table();
    text.add(llocal).expandX().fillX();
    text.row();
    text.add().fillY().expandY();
    sp = new ScrollPane(text, GnuBackgammon.skin.get("info", ScrollPaneStyle.class));
    sp.setFadeScrollBars(false);
    sp.setForceOverscroll(false, false);
    sp.setOverscroll(false, false);

    table.row();
    table.add(t1).colspan(3).fill().expand();
    table.add(sp).colspan(4).fill().expand().padLeft(stage.getWidth() / 20);

    table.row();
    table.add().fill().expand().colspan(7).height(height / 2);

    table.row().height(height);
    table.add();
    table.add(back).fill().colspan(2);
    table.add();
    table.add(play).fill().colspan(2);
    table.add();

    stage.addActor(table);

    connecting = new Label("Connecting to server...", GnuBackgammon.skin);
    connecting.setVisible(false);
    connecting.setX((stage.getWidth() - connecting.getWidth()) / 2);
    connecting.setY(height * 1.5f);
    connecting.addAction(Actions.forever(Actions.sequence(Actions.alpha(0.5f, 0.4f), Actions.alpha(1, 0.4f))));
    stage.addActor(connecting);
}

From source file:it.alcacoop.backgammon.ui.UIDialog.java

License:Open Source License

public static void getHelpDialog(Boolean cb) {
    Stage stage = GnuBackgammon.Instance.currentScreen.getStage();
    instance.visible = true;//from ww w . ja  v a 2  s.  c  o m
    instance.evt = Events.NOOP;
    instance.quitWindow = false;
    instance.leaveWindow = false;
    instance.optionsWindow = false;
    instance.dicesWindow = false;
    instance.remove();
    Label l = new Label(
            "GAME TYPE\n" + "You can choose two game type, and several options:\n"
                    + "Backgammon - usual starting position\n"
                    + "Nackgammon - Nack's starting position, attenuates lucky starting roll\n"
                    + "Doubling Cube: use or not the doubling cube, with or without Crawford rule\n\n"
                    + "START TURN\n" + "If cube isn't available, dices are rolled automatically,\n"
                    + "else you must click on 'Double' or 'Roll' button\n\n" + "MOVING MECHANIC\n"
                    + "You can choose two moves mechanic (Options->Move Logic):\n"
                    + "TAP - once you rolled dices, select the piece you would move.\n"
                    + "If legal moves for that piece are available, they will be shown.\n"
                    + "Click an available point and the piece will move there.\n"
                    + "AUTO - click on a piece and it moves automatically to destination point.\n"
                    + "Bigger dice is played first. You can change dice order clicking on dices\n\n"
                    + "You can cancel your moves in current hand just clicking the UNDO button\n"
                    + "in the game options menu popup.\n\n" + "END TURN\n"
                    + "When you finish your turn, click again the dices to take back them and change turn.\n",
            GnuBackgammon.skin);
    l.setWrap(true);

    ScrollPane sc = new ScrollPane(l, GnuBackgammon.skin);
    sc.setFadeScrollBars(false);
    sc.setOverscroll(false, false);

    float height = stage.getHeight() * 0.85f;
    float width = stage.getWidth() * 0.9f;

    instance.clear();
    instance.row().padTop(width / 25);
    instance.add(sc).colspan(3).expand().fill().align(Align.center).padTop(width / 25).padLeft(width / 35)
            .padRight(width / 35);

    instance.row().pad(width / 25);
    instance.add();
    instance.add(instance.bContinue).fill().expand().height(height * 0.15f).width(width / 4);
    instance.add();

    instance.setWidth(width);
    instance.setHeight(height);
    instance.setX((stage.getWidth() - width) / 2);
    instance.setY((stage.getHeight() - height) / 2);

    stage.addActor(instance);
    instance.setY(stage.getHeight());
    instance.addAction(
            Actions.sequence(
                    MyActions
                            .sequence(Actions.parallel(Actions.color(new Color(1, 1, 1, alpha), 0.2f),
                                    Actions.moveTo((stage.getWidth() - width) / 2,
                                            (stage.getHeight() - height) / 2, 0.2f))),
                    Actions.run(new Runnable() {
                        @Override
                        public void run() {
                            Gdx.graphics.setContinuousRendering(true);
                        }
                    })));
}

From source file:it.alcacoop.backgammon.ui.UIDialog.java

License:Open Source License

public static void getAboutDialog(Boolean cb) {
    Stage stage = GnuBackgammon.Instance.currentScreen.getStage();
    instance.visible = true;//  w  w w  .  j  av  a  2  s  .co  m
    instance.evt = Events.NOOP;
    instance.quitWindow = false;
    instance.leaveWindow = false;
    instance.optionsWindow = false;
    instance.dicesWindow = false;
    instance.remove();

    final String gnuBgLink = "http://www.gnubg.org";
    final String gplLink = "http://www.gnu.org/licenses/gpl.html";
    final String githubLink1 = "https://github.com/alcacoop/it.alcacoop.backgammon";
    final String githubLink2 = "https://github.com/alcacoop/libgnubg-android";
    final String wikipediaLink = "http://en.wikipedia.org/wiki/Backgammon#Rules";

    Table t = new Table();
    t.add(new Label("ABOUT BACKGAMMON MOBILE", GnuBackgammon.skin)).expand();
    t.row();
    t.add(new Label(" ", GnuBackgammon.skin)).fill().expand();
    t.row();
    t.add(new Label("Backgammon Mobile is based on GNUBackgammon (gnubg)", GnuBackgammon.skin));
    Label link1 = new Label(gnuBgLink, GnuBackgammon.skin);
    link1.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            GnuBackgammon.Instance.nativeFunctions.openURL(gnuBgLink);
        };
    });
    t.row();
    t.add(link1);
    t.row();
    t.add(new Label(" ", GnuBackgammon.skin)).fill().expand();
    t.row();
    t.add(new Label("Its source code is released under a GPLv3 License", GnuBackgammon.skin));
    Label link2 = new Label(gplLink, GnuBackgammon.skin);
    link2.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            GnuBackgammon.Instance.nativeFunctions.openURL(gplLink);
        };
    });
    t.row();
    t.add(link2);
    t.row();
    t.add(new Label(" ", GnuBackgammon.skin)).fill().expand();
    t.row();
    t.add(new Label("and is available on GitHub at:", GnuBackgammon.skin));
    Label link3 = new Label(githubLink1, GnuBackgammon.skin);
    link3.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            GnuBackgammon.Instance.nativeFunctions.openURL(githubLink1);
        };
    });
    Label link4 = new Label(githubLink2, GnuBackgammon.skin);
    link4.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            GnuBackgammon.Instance.nativeFunctions.openURL(githubLink2);
        };
    });
    t.row();
    t.add(link3);
    t.row();
    t.add(link4);
    t.row();
    t.add(new Label(" ", GnuBackgammon.skin)).fill().expand();
    t.row();
    t.add(new Label("You can find a detailed description of game rules on Wikipedia:", GnuBackgammon.skin));
    Label link5 = new Label(wikipediaLink, GnuBackgammon.skin);
    link5.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            GnuBackgammon.Instance.snd.playMoveStart();
            GnuBackgammon.Instance.nativeFunctions.openURL(wikipediaLink);
        };
    });
    t.row();
    t.add(link5);
    t.row();
    t.add(new Label(" ", GnuBackgammon.skin)).fill().expand();
    t.row();
    t.add(new Label("If you enjoy our game support us rating on the Play Store", GnuBackgammon.skin));
    t.row();
    t.add(new Label(" ", GnuBackgammon.skin)).fill().expand();
    t.row();
    t.add(new Label("Copyright 2012 - Alca Soc. Coop.", GnuBackgammon.skin));

    ScrollPane sc = new ScrollPane(t, GnuBackgammon.skin);
    sc.setFadeScrollBars(false);
    sc.setOverscroll(false, false);

    float height = stage.getHeight() * 0.85f;
    float width = stage.getWidth() * 0.95f;

    instance.clear();
    instance.row().padTop(width / 25);
    instance.add(sc).colspan(3).expand().fill().align(Align.center).padTop(width / 25).padLeft(width / 35)
            .padRight(width / 35);

    instance.row().pad(width / 25);
    instance.add();
    instance.add(instance.bContinue).fill().expand().height(height * 0.15f).width(width / 4);
    instance.add();

    instance.setWidth(width);
    instance.setHeight(height);
    instance.setX((stage.getWidth() - width) / 2);

    stage.addActor(instance);
    instance.setY(stage.getHeight());
    instance.addAction(
            Actions.sequence(
                    MyActions
                            .sequence(Actions.parallel(Actions.color(new Color(1, 1, 1, alpha), 0.2f),
                                    Actions.moveTo((stage.getWidth() - width) / 2,
                                            (stage.getHeight() - height) / 2, 0.2f))),
                    Actions.run(new Runnable() {
                        @Override
                        public void run() {
                            Gdx.graphics.setContinuousRendering(true);
                        }
                    })));
}

From source file:it.alcacoop.fourinaline.actors.UIDialog.java

License:Open Source License

public static void getAboutDialog() {
    Stage stage = FourInALine.Instance.currentScreen.getStage();
    instance.visible = true;//www .j ava 2  s. c o  m
    instance.evt = Events.NOOP;
    instance.quitWindow = false;
    instance.leaveWindow = false;
    instance.remove();

    final String gnuBgLink = "http://code.google.com/p/fourinaline";
    final String gplLink = "http://www.gnu.org/licenses/gpl.html";
    final String githubLink1 = "https://github.com/alcacoop/it.alcacoop.fourinaline";
    final String wikipediaLink = "http://en.wikipedia.org/wiki/Connect_Four";

    Table t = new Table();
    t.add(new Label("ABOUT FOUR IN A LINE MOBILE", FourInALine.Instance.skin)).expand();
    t.row();
    t.add(new Label(" ", FourInALine.Instance.skin)).fill().expand();
    t.row();
    t.add(new Label("\"Four in a Line Mobile!\" is based on FourInALine", FourInALine.Instance.skin));
    Label link1 = new Label(gnuBgLink, FourInALine.Instance.skin);
    link1.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            FourInALine.Instance.snd.playMove();
            FourInALine.Instance.nativeFunctions.openURL(gnuBgLink);
        };
    });
    t.row();
    t.add(link1);
    t.row();
    t.add(new Label(" ", FourInALine.Instance.skin)).fill().expand();
    t.row();
    t.add(new Label("Its source code is released under a GPLv3 License", FourInALine.Instance.skin));
    Label link2 = new Label(gplLink, FourInALine.Instance.skin);
    link2.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            FourInALine.Instance.snd.playMove();
            FourInALine.Instance.nativeFunctions.openURL(gplLink);
        };
    });
    t.row();
    t.add(link2);
    t.row();
    t.add(new Label(" ", FourInALine.Instance.skin)).fill().expand();
    t.row();
    t.add(new Label("and is available on GitHub at:", FourInALine.Instance.skin));
    Label link3 = new Label(githubLink1, FourInALine.Instance.skin);
    link3.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            FourInALine.Instance.snd.playMove();
            FourInALine.Instance.nativeFunctions.openURL(githubLink1);
        };
    });

    t.row();
    t.add(link3);

    t.row();
    t.add(new Label(" ", FourInALine.Instance.skin)).fill().expand();
    t.row();
    t.add(new Label("You can find a detailed description of game rules on Wikipedia:",
            FourInALine.Instance.skin));
    Label link5 = new Label(wikipediaLink, FourInALine.Instance.skin);
    link5.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            FourInALine.Instance.snd.playMove();
            FourInALine.Instance.nativeFunctions.openURL(wikipediaLink);
        };
    });
    t.row();
    t.add(link5);
    t.row();
    t.add(new Label(" ", FourInALine.Instance.skin)).fill().expand();
    t.row();
    t.add(new Label("If you enjoy our game, support us rating on the Play Store", FourInALine.Instance.skin));
    t.row();
    t.add(new Label(" ", FourInALine.Instance.skin)).fill().expand();
    t.row();
    t.add(new Label("Copyright 2013 - Alca Soc. Coop.", FourInALine.Instance.skin));

    ScrollPane sc = new ScrollPane(t, FourInALine.Instance.skin);
    sc.setFadeScrollBars(false);
    sc.setOverscroll(false, false);

    float height = stage.getHeight() * 0.85f;
    float width = stage.getWidth() * 0.95f;

    instance.clear();
    instance.row().padTop(width / 25);
    instance.add(sc).colspan(3).expand().fill().align(Align.center).padTop(width / 25).padLeft(width / 35)
            .padRight(width / 35);

    instance.row().pad(width / 25);
    instance.add();
    instance.add(instance.bContinue).fill().expand().height(height * 0.15f).width(width / 4);
    instance.add();

    instance.setWidth(width);
    instance.setHeight(height);
    instance.setX((stage.getWidth() - width) / 2);

    stage.addActor(instance);
    instance.setY(stage.getHeight());
    instance.addAction(Actions.sequence(Actions.parallel(Actions.color(new Color(1, 1, 1, alpha), 0.2f),
            Actions.moveTo((stage.getWidth() - width) / 2, (stage.getHeight() - height) / 2, 0.2f))));
}

From source file:kyle.game.besiege.panels.BottomPanel.java

License:Open Source License

public BottomPanel(SidePanel panel) {
    this.region = new TextureRegion(Assets.atlas.findRegion(textureRegion));
    this.black = new TextureRegion(Assets.atlas.findRegion(textureBlack));

    this.panel = panel;

    this.setHeight(HEIGHT);
    this.setWidth(BesiegeMain.WIDTH - SidePanel.WIDTH);
    this.setX(-this.getWidth());
    this.setY(0);

    logging = 0;/*from   www. ja va  2  s .  c  o  m*/

    ls = new LabelStyle();
    ls.font = Assets.pixel15;

    logText = new Label("", ls);
    logText.setWrap(true);
    spStyle = new ScrollPane.ScrollPaneStyle();
    logTable = new Table();
    logTable.defaults().bottom().left().padTop(NEG);
    logTable.add(logText);
    logTable.bottom().left();
    //logTable.debug();

    spStyle.vScroll = new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(barTexture), r, r, r, r));
    spStyle.vScrollKnob = new NinePatchDrawable(
            new NinePatch(Assets.atlas.findRegion(knobTexture), r, r, r, r));
    sp = new ScrollPane(logTable, spStyle);
    sp.setScrollingDisabled(true, false);
    sp.setFadeScrollBars(false);
    sp.setBounds(PAD * 2, PAD, this.getWidth() - PAD * 4, BottomPanel.HEIGHT - PAD * 2);
    sp.setScrollbarsOnTop(true);

    this.addActor(sp);

    //      log("hey", "purple");
    //      log("look", "magenta");
    //      log("this", "blue");
    //      log("thing", "cyan");
    //      log("is", "green");
    //      log("a", "yellow");
    //      log("log", "orange");
    //      log("yum", "red");
}

From source file:kyle.game.besiege.panels.BottomPanel.java

License:Open Source License

public void resize() {
    this.removeActor(sp);
    sp = new ScrollPane(logTable, spStyle);
    sp.setScrollingDisabled(true, false);
    sp.setFadeScrollBars(false);/*from   ww w  .  ja v  a 2 s .  co  m*/
    sp.setBounds(PAD * 2, PAD, this.getWidth() - PAD * 2, BottomPanel.HEIGHT - PAD * 2);
    sp.setScrollbarsOnTop(true);
    this.addActor(sp);
}

From source file:kyle.game.besiege.panels.Panel.java

License:Open Source License

public void resize() {
    this.removeActor(topPane);
    topPane = new ScrollPane(topTable, spStyle);
    topPane.setScrollingDisabled(true, false);
    topPane.setFadeScrollBars(false);// w  ww. j  a  v a2 s  . c o  m
    topPane.setBounds(PAD, PAD + BUTTONHEIGHT, SidePanel.WIDTH - PAD * 2,
            parentPanel.getHeight() - SidePanel.WIDTH - BUTTONHEIGHT - PAD * 2);
    this.addActor(topPane);
}

From source file:kyle.game.besiege.panels.Panel.java

License:Open Source License

public void addTopTable(Table topTable) {
    this.topTable = topTable;
    //topTable.debug();
    topTable.top();//from w w  w.ja  v a 2 s  .  c o  m
    spStyle = new ScrollPane.ScrollPaneStyle();

    spStyle.vScroll = new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(barTexture), r, r, r, r));
    spStyle.vScrollKnob = new NinePatchDrawable(
            new NinePatch(Assets.atlas.findRegion(knobTexture), r, r, r, r));

    topPane = new ScrollPane(topTable, spStyle);
    topPane.setY(parentPanel.getHeight() - SidePanel.WIDTH);
    topPane.setX(0);
    topPane.setWidth(SidePanel.WIDTH - PAD * 2);
    topPane.setHeight(parentPanel.getHeight() - SidePanel.WIDTH);
    topPane.setScrollingDisabled(true, false);
    this.addActor(topPane);
}