List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ButtonGroup setMinCheckCount
public void setMinCheckCount(int minCheckCount)
From source file:gaia.cu9.ari.gaiaorbit.interfce.AboutWindow.java
License:Open Source License
public AboutWindow(Stage stg, Skin sk) { super(txt("gui.help.help") + " - " + GlobalConf.APPLICATION_NAME + " v" + GlobalConf.version.version, sk); this.stage = stg; this.skin = sk; this.me = this; this.linkStyle = skin.get("link", LabelStyle.class); float tawidth = 440 * GlobalConf.SCALE_FACTOR; float taheight = 250 * GlobalConf.SCALE_FACTOR; float taheight_s = 60 * GlobalConf.SCALE_FACTOR; float tabwidth = 60 * GlobalConf.SCALE_FACTOR; float pad = 5 * GlobalConf.SCALE_FACTOR; scrolls = new ArrayList<OwnScrollPane>(5); textareas = new ArrayList<Actor>(); /** TABLE and SCROLL **/ table = new Table(skin); // Create the tab buttons HorizontalGroup group = new HorizontalGroup(); group.align(Align.left);/*www .j av a 2 s . c o m*/ final Button tab1 = new OwnTextButton(txt("gui.help.help"), skin, "toggle-big"); tab1.pad(pad); tab1.setWidth(tabwidth); final Button tab2 = new OwnTextButton(txt("gui.help.about"), skin, "toggle-big"); tab2.pad(pad); tab2.setWidth(tabwidth); final Button tab3 = new OwnTextButton(txt("gui.help.system"), skin, "toggle-big"); tab3.pad(pad); tab3.setWidth(tabwidth); group.addActor(tab1); group.addActor(tab2); group.addActor(tab3); table.add(group).align(Align.left).padLeft(pad); table.row(); // Create the tab content. Just using images here for simplicity. Stack content = new Stack(); /** CONTENT 1 - HELP **/ final Table content1 = new Table(skin); content1.align(Align.top); Image gaiasky = new Image(getSpriteDrawable(Gdx.files.internal("img/gaiaskylogo.png"))); // User manual Label usermantitle = new OwnLabel(txt("gui.help.usermanual"), skin, "ui-12"); Label usermantxt = new OwnLabel(txt("gui.help.help1"), skin, "ui-11"); Link usermanlink = new Link(GlobalConf.WEBPAGE, linkStyle, GlobalConf.WEBPAGE); // Wiki Label wikititle = new OwnLabel("Docs", skin, "ui-12"); Label wikitxt = new OwnLabel(txt("gui.help.help2"), skin, "ui-11"); Link wikilink = new Link(GlobalConf.DOCUMENTATION, linkStyle, GlobalConf.DOCUMENTATION); // Readme Label readmetitle = new OwnLabel(txt("gui.help.readme"), skin, "ui-12"); FileHandle readmefile = Gdx.files.internal("README.md"); if (!readmefile.exists()) { readmefile = Gdx.files.internal("../README.md"); } String readmestr = readmefile.readString(); int lines = GlobalResources.countOccurrences(readmestr, '\n'); TextArea readme = new TextArea(readmestr, skin); readme.setDisabled(true); readme.setPrefRows(lines); textareas.add(readme); OwnScrollPane readmescroll = new OwnScrollPane(readme, skin, "default-nobg"); readmescroll.setWidth(tawidth); readmescroll.setHeight(taheight); readmescroll.setForceScroll(false, true); readmescroll.setSmoothScrolling(true); readmescroll.setFadeScrollBars(false); scrolls.add(readmescroll); // Add all to content content1.add(gaiasky).colspan(2); content1.row(); content1.add(usermantitle).align(Align.left).padRight(pad * 2); content1.add(usermantxt).align(Align.left); content1.row(); content1.add(new OwnLabel("", skin, "ui-11")); content1.add(usermanlink).align(Align.left); content1.row(); content1.add(wikititle).align(Align.left).padRight(pad * 2); content1.add(wikitxt).align(Align.left); content1.row(); content1.add(new OwnLabel("", skin, "ui-11")); content1.add(wikilink).align(Align.left); content1.row(); content1.add(readmetitle).colspan(2).align(Align.left); content1.row(); content1.add(readmescroll).colspan(2).expand().pad(pad * 2, 0, pad * 2, 0).align(Align.center); /** CONTENT 2 - ABOUT **/ final Table content2 = new Table(skin); content2.align(Align.top); // Intro TextArea intro = new OwnTextArea(txt("gui.help.gscredits", GlobalConf.version.version), skin.get("msg-11", TextFieldStyle.class)); intro.setDisabled(true); intro.setPrefRows(3); intro.setWidth(tawidth); textareas.add(intro); // Home page Label homepagetitle = new OwnLabel(txt("gui.help.homepage"), skin, "ui-12"); Link homepage = new Link(GlobalConf.WEBPAGE, linkStyle, GlobalConf.WEBPAGE); // Author Label authortitle = new OwnLabel(txt("gui.help.author"), skin, "ui-12"); VerticalGroup author = new VerticalGroup(); author.align(Align.left); Label authorname = new OwnLabel("Toni Sagrist Sells", skin, "ui-11"); Link authormail = new Link("tsagrista@ari.uni-heidelberg.de", linkStyle, "mailto:tsagrista@ari.uni-heidelberg.de"); Link authorpage = new Link("www.tonisagrista.com", linkStyle, "http://tonisagrista.com"); author.addActor(authorname); author.addActor(authormail); author.addActor(authorpage); // Contributor Label contribtitle = new OwnLabel(txt("gui.help.contributors"), skin, "ui-12"); VerticalGroup contrib = new VerticalGroup(); contrib.align(Align.left); Label contribname = new OwnLabel("Apl. Prof. Dr. Stefan Jordan", skin, "ui-11"); Link contribmail = new Link("jordan@ari.uni-heidelberg.de", linkStyle, "mailto:jordan@ari.uni-heidelberg.de"); contrib.addActor(contribname); contrib.addActor(contribmail); // License HorizontalGroup licenseh = new HorizontalGroup(); licenseh.space(pad * 2); Image license = new Image(getSpriteDrawable(Gdx.files.internal("img/license.png"))); VerticalGroup licensev = new VerticalGroup(); TextArea licensetext = new OwnTextArea(txt("gui.help.license"), skin.get("msg-11", TextFieldStyle.class)); licensetext.setDisabled(true); licensetext.setPrefRows(3); licensetext.setWidth(tawidth / 2f); Link licenselink = new Link("https://www.gnu.org/licenses/gpl.html", linkStyle, "https://www.gnu.org/licenses/gpl.html"); licensev.addActor(licensetext); licensev.addActor(licenselink); licenseh.addActor(license); licenseh.addActor(licensev); // Thanks HorizontalGroup thanks = new HorizontalGroup(); thanks.space(pad * 2); Container thanksc = new Container(thanks); thanksc.setBackground(skin.getDrawable("bg-clear")); Image zah = new Image(getSpriteDrawable(Gdx.files.internal("img/zah.png"))); Image dlr = new Image(getSpriteDrawable(Gdx.files.internal("img/dlr.png"))); Image bwt = new Image(getSpriteDrawable(Gdx.files.internal("img/bwt.png"))); Image dpac = new Image(getSpriteDrawable(Gdx.files.internal("img/dpac.png"))); thanks.addActor(zah); thanks.addActor(dlr); thanks.addActor(bwt); thanks.addActor(dpac); content2.add(intro).colspan(2).align(Align.left).padTop(pad * 2); content2.row(); content2.add(homepagetitle).align(Align.topLeft).padRight(pad * 2); content2.add(homepage).align(Align.left); content2.row(); content2.add(authortitle).align(Align.topLeft).padRight(pad * 2).padTop(pad); content2.add(author).align(Align.left).padTop(pad); content2.row(); content2.add(contribtitle).align(Align.topLeft).padRight(pad * 2).padTop(pad); content2.add(contrib).align(Align.left).padTop(pad); content2.row(); content2.add(licenseh).colspan(2).align(Align.center).padTop(pad * 4); content2.row(); content2.add(thanksc).colspan(2).align(Align.center).padTop(pad * 8); /** CONTENT 3 - SYSTEM **/ final Table content3 = new Table(skin); content3.align(Align.top); // Build info Label buildinfo = new OwnLabel(txt("gui.help.buildinfo"), skin, "help-title"); Label versiontitle = new OwnLabel(txt("gui.help.version", GlobalConf.APPLICATION_NAME), skin, "ui-12"); Label version = new OwnLabel(GlobalConf.version.version, skin, "ui-11"); Label revisiontitle = new OwnLabel(txt("gui.help.buildnumber"), skin, "ui-12"); Label revision = new OwnLabel(GlobalConf.version.build, skin, "ui-11"); Label timetitle = new OwnLabel(txt("gui.help.buildtime"), skin, "ui-12"); Label time = new OwnLabel(GlobalConf.version.buildtime, skin, "ui-11"); Label systemtitle = new OwnLabel(txt("gui.help.buildsys"), skin, "ui-12"); TextArea system = new OwnTextArea(GlobalConf.version.system, skin.get("msg-11", TextFieldStyle.class)); system.setDisabled(true); system.setPrefRows(3); system.setWidth(tawidth * 2f / 3f); textareas.add(system); Label buildertitle = new OwnLabel(txt("gui.help.builder"), skin, "ui-12"); Label builder = new OwnLabel(GlobalConf.version.builder, skin, "ui-11"); // Java info Label javainfo = new OwnLabel(txt("gui.help.javainfo"), skin, "help-title"); Label javaversiontitle = new OwnLabel(txt("gui.help.javaversion"), skin, "ui-12"); Label javaversion = new OwnLabel(System.getProperty("java.version"), skin, "ui-11"); Label javaruntimetitle = new OwnLabel(txt("gui.help.javaname"), skin, "ui-12"); Label javaruntime = new OwnLabel(System.getProperty("java.runtime.name"), skin, "ui-11"); Label javavmnametitle = new OwnLabel(txt("gui.help.javavmname"), skin, "ui-12"); Label javavmname = new OwnLabel(System.getProperty("java.vm.name"), skin, "ui-11"); Label javavmversiontitle = new OwnLabel(txt("gui.help.javavmversion"), skin, "ui-12"); Label javavmversion = new OwnLabel(System.getProperty("java.vm.version"), skin, "ui-11"); Label javavmvendortitle = new OwnLabel(txt("gui.help.javavmvendor"), skin, "ui-12"); Label javavmvendor = new OwnLabel(System.getProperty("java.vm.vendor"), skin, "ui-11"); TextButton memoryinfobutton = new OwnTextButton(txt("gui.help.meminfo"), skin, "default"); memoryinfobutton.setName("memoryinfo"); memoryinfobutton.setSize(150 * GlobalConf.SCALE_FACTOR, 20 * GlobalConf.SCALE_FACTOR); memoryinfobutton.addListener(new EventListener() { @Override public boolean handle(Event event) { if (event instanceof ChangeEvent) { EventManager.instance.post(Events.DISPLAY_MEM_INFO_WINDOW, stage, skin); return true; } return false; } }); // OpenGL info Label glinfo = new OwnLabel(txt("gui.help.openglinfo"), skin, "help-title"); Label glversiontitle = new OwnLabel(txt("gui.help.openglversion"), skin, "ui-12"); Label glversion = new OwnLabel(Gdx.gl.glGetString(GL20.GL_VERSION), skin, "ui-11"); Label glslversiontitle = new OwnLabel(txt("gui.help.glslversion"), skin, "ui-12"); Label glslversion = new OwnLabel(Gdx.gl.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION), skin, "ui-11"); Label glextensionstitle = new OwnLabel(txt("gui.help.glextensions"), skin, "ui-12"); String glextensionsstr = Gdx.gl.glGetString(GL20.GL_EXTENSIONS).replace(' ', '\r'); lines = GlobalResources.countOccurrences(glextensionsstr, '\r') + 1; IntBuffer buf = BufferUtils.newIntBuffer(16); Gdx.gl.glGetIntegerv(Gdx.graphics.getGL20().GL_MAX_TEXTURE_SIZE, buf); int maxSize = buf.get(0); TextArea glextensions = new TextArea("Max texture size: " + maxSize + "\r" + glextensionsstr, skin); glextensions.setDisabled(true); glextensions.setPrefRows(lines); textareas.add(glextensions); OwnScrollPane glextensionsscroll = new OwnScrollPane(glextensions, skin, "default-nobg"); glextensionsscroll.setWidth(tawidth / 1.7f); glextensionsscroll.setHeight(taheight_s); glextensionsscroll.setForceScroll(false, true); glextensionsscroll.setSmoothScrolling(true); glextensionsscroll.setFadeScrollBars(false); scrolls.add(glextensionsscroll); content3.add(buildinfo).colspan(2).align(Align.left).padTop(pad * 3); content3.row(); content3.add(versiontitle).align(Align.topLeft).padRight(pad * 2); content3.add(version).align(Align.left); content3.row(); content3.add(revisiontitle).align(Align.topLeft).padRight(pad * 2); content3.add(revision).align(Align.left); content3.row(); content3.add(timetitle).align(Align.topLeft).padRight(pad * 2); content3.add(time).align(Align.left); content3.row(); content3.add(buildertitle).align(Align.topLeft).padRight(pad * 2); content3.add(builder).align(Align.left).padBottom(pad * 3); content3.row(); content3.add(systemtitle).align(Align.topLeft).padRight(pad * 2); content3.add(system).align(Align.left); content3.row(); content3.add(javainfo).colspan(2).align(Align.left).padTop(pad * 2); content3.row(); content3.add(javaversiontitle).align(Align.topLeft).padRight(pad * 2); content3.add(javaversion).align(Align.left); content3.row(); content3.add(javaruntimetitle).align(Align.topLeft).padRight(pad * 2); content3.add(javaruntime).align(Align.left); content3.row(); content3.add(javavmnametitle).align(Align.topLeft).padRight(pad * 2); content3.add(javavmname).align(Align.left); content3.row(); content3.add(javavmversiontitle).align(Align.topLeft).padRight(pad * 2); content3.add(javavmversion).align(Align.left); content3.row(); content3.add(javavmvendortitle).align(Align.topLeft).padRight(pad * 2); content3.add(javavmvendor).align(Align.left).padBottom(pad * 2); content3.row(); content3.add(memoryinfobutton).colspan(2).align(Align.left).padBottom(pad * 3); content3.row(); content3.add(glinfo).colspan(2).align(Align.left).padTop(pad * 2); content3.row(); content3.add(glversiontitle).align(Align.topLeft).padRight(pad * 2); content3.add(glversion).align(Align.left); content3.row(); content3.add(glslversiontitle).align(Align.topLeft).padRight(pad * 2); content3.add(glslversion).align(Align.left); content3.row(); content3.add(glextensionstitle).align(Align.topLeft).padRight(pad * 2); content3.add(glextensionsscroll).align(Align.left); /** ADD ALL CONTENT **/ content.addActor(content1); content.addActor(content2); content.addActor(content3); table.add(content).expand().fill(); // Listen to changes in the tab button checked states // Set visibility of the tab content to match the checked state ChangeListener tab_listener = new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { content1.setVisible(tab1.isChecked()); content2.setVisible(tab2.isChecked()); content3.setVisible(tab3.isChecked()); } }; tab1.addListener(tab_listener); tab2.addListener(tab_listener); tab3.addListener(tab_listener); // Let only one tab button be checked at a time ButtonGroup tabs = new ButtonGroup(); tabs.setMinCheckCount(1); tabs.setMaxCheckCount(1); tabs.add(tab1); tabs.add(tab2); tabs.add(tab3); /** BUTTONS **/ HorizontalGroup buttonGroup = new HorizontalGroup(); TextButton close = new OwnTextButton(txt("gui.close"), skin, "default"); close.setName("close"); close.setSize(70 * GlobalConf.SCALE_FACTOR, 20 * GlobalConf.SCALE_FACTOR); close.addListener(new EventListener() { @Override public boolean handle(Event event) { if (event instanceof ChangeEvent) { me.hide(); return true; } return false; } }); buttonGroup.addActor(close); add(table).pad(pad); row(); add(buttonGroup).pad(pad).bottom().right(); getTitleTable().align(Align.left); pack(); this.setPosition(Math.round(stage.getWidth() / 2f - this.getWidth() / 2f), Math.round(stage.getHeight() / 2f - this.getHeight() / 2f)); /** CAPTURE SCROLL FOCUS **/ stage.addListener(new EventListener() { @Override public boolean handle(Event event) { if (event instanceof InputEvent) { InputEvent ie = (InputEvent) event; if (ie.getType() == Type.mouseMoved) { for (OwnScrollPane scroll : scrolls) { if (ie.getTarget().isDescendantOf(scroll)) { stage.setScrollFocus(scroll); } } return true; } } return false; } }); }
From source file:org.anism.lotw.LOTW.java
License:Open Source License
public void initEverything() { Color fullAnti = new Color(G.getAntiColor()); fullAnti.a = 1;// w w w .j a v a2 s .co m Texture upTexture = new Texture(Gdx.files.internal("images/grey_button_up.png")); Texture downTexture = new Texture(Gdx.files.internal("images/grey_button_down.png")); NinePatch buttonPatchUp = new NinePatch(upTexture, 11, 11, 11, 11); NinePatch buttonPatchDown = new NinePatch(downTexture, 11, 11, 11, 11); NinePatchDrawable npdUp = new NinePatchDrawable(buttonPatchUp); NinePatchDrawable npdDown = new NinePatchDrawable(buttonPatchDown); textButtonStyle = new TextButton.TextButtonStyle(npdUp, npdDown, npdUp, G.roboto16); textButtonStyle.fontColor = new Color(G.getAntiColor()); textButtonStyle.fontColor.a = 1; buttonStyle = new ButtonStyle(npdUp, npdDown, npdUp); labelStyle = new Label.LabelStyle(G.roboto24, G.getAntiColor()); labelStyleSmall = new Label.LabelStyle(G.roboto16, G.getAntiColor()); resumeButton = addIconButton(game, G.playIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { if (!G.pausing) { G.pause(); } } }, buttonWidth / dpi / 2 + 4 * dpi, -48, buttonWidth / dpi, 88); resumeButton.setColor(G.colors.green); exitButton = addIconButton(game, G.backIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { if (!G.pausing) { G.gameOver(); } } }, -buttonWidth / dpi / 2 - 4 * dpi, -48, buttonWidth / dpi, 88); exitButton.setColor(G.colors.red); togglePauseButtons(); //intro.addActor(logo); //putLogo(settings); putLogo(instructions); //putLogo(statistics); /* // intro screen: addButton(intro, game, "Start Game", 0, 0, 200f, 40f); addButton(intro, settings, "Settings", 0, -70, 100f, 40f); addButton(intro, instructions, "How to Play", 0, -120, 100f, 40f); */ // settings screen: ImageTextButton.ImageTextButtonStyle lbs = new ImageTextButton.ImageTextButtonStyle(textButtonStyle); TextureRegionDrawable gamepadDrawable = new TextureRegionDrawable(new TextureRegion(G.controllerIcon)); lbs.imageChecked = gamepadDrawable; lbs.imageCheckedOver = gamepadDrawable; lbs.imageDisabled = gamepadDrawable; lbs.imageDown = gamepadDrawable; lbs.imageOver = gamepadDrawable; lbs.imageUp = gamepadDrawable; logButton = new ImageTextButton("Sign In", lbs); if (actionResolver.getSignedInGPGS()) { logButton.setText("Sign Out"); } logButton.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { if (actionResolver.getSignedInGPGS()) { actionResolver.logoutGPGS(); } else { actionResolver.loginGPGS(); } G.toggleAutologin(); } }); logButton.setWidth(184 * dpi); logButton.setHeight(88 * dpi); logButton.setColor(G.colors.grey); logButton.getImage().setColor(fullAnti); //settings.addActor(logButton); TextureRegionDrawable cbOn = new TextureRegionDrawable(new TextureRegion(G.dashIcon)); TextureRegionDrawable cbOff = new TextureRegionDrawable(new TextureRegion(G.circleIcon)); CheckBoxStyle cbs = new CheckBoxStyle(cbOff, cbOn, G.roboto16, fullAnti); cbs.checked = npdUp; cbs.checkedOver = npdUp; cbs.down = npdDown; cbs.over = npdUp; cbs.up = npdUp; // colorblind settings: CheckBox colorButton = new CheckBox("", cbs); colorButton.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.toggleColorblind(); } }); colorButton.setWidth(88 * dpi); colorButton.setHeight(88 * dpi); /* colorButton.setPosition(G.width/2 - 188 * dpi, G.height/2 + 100*dpi); */ Table colorTable = makeSettingsTable("Display"); colorButton.setColor(Math.random() > 0.5 ? G.colors.green : G.colors.red); colorButton.getImage().setColor(fullAnti); colorButton.setChecked(G.settings.colorblind); ListStyle listStyle = new ListStyle(G.roboto16, G.getAntiColor(), G.getAntiColor(), npdDown); listStyle.background = npdUp; SelectBoxStyle sbs = new SelectBoxStyle(G.roboto16, new Color(0x00000000), npdUp, new ScrollPane.ScrollPaneStyle(), listStyle); final SelectBox<Season> seasonPicker = new SelectBox(sbs); seasonPicker.setItems((Season[]) G.settings.getUnlockedSeasons()); if (G.settings.unlock) { seasonPicker.setSelected(G.settings.unlockSeason); } else { seasonPicker.setSelected(G.settings.getSeason()); } seasonPicker.setColor(G.colors.grey); seasonPicker.getList().setColor(G.colors.grey); Stack seasonStack = new Stack(); final Container seasonImage = new Container(new Image(seasonPicker.getSelected().getIcon())); seasonImage.setSize(32, 32); seasonImage.setTouchable(Touchable.disabled); seasonImage.getActor().setColor(G.getAntiColor()); seasonStack.add(seasonPicker); seasonStack.add(seasonImage); seasonPicker.addListener(new ChangeListener() { @Override public void changed(ChangeEvent e, Actor a) { Season s = seasonPicker.getSelected(); if (s.getName().toUpperCase().equals("UNLOCK")) { G.glider.score = 0; G.settings.unlock = true; G.settings.setSeason(G.settings.getSeasons()[0]); G.updateBgColor(); G.lotw.resetEverything(); } else { G.settings.unlock = false; G.changeSeason(s); } } }); putSettingsButton(colorTable, seasonStack, "Season."); CheckBox ninjaButton = new CheckBox("", cbs); ninjaButton.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.toggleNinja(); } }); ninjaButton.setColor(G.colors.grey); ninjaButton.getImage().setColor(fullAnti); ninjaButton.setChecked(G.settings.ninjaMode); putSettingsButton(colorTable, colorButton, "Add markings to distinguish red and green orbs."); putSettingsButton(colorTable, ninjaButton, "Ninja mode."); // advanced settings: CheckBox bottomButton = new CheckBox("", cbs); bottomButton.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.toggleBottomOut(); } }); bottomButton.setChecked(G.settings.bottomOut); bottomButton.setColor(G.colors.grey); bottomButton.getImage().setColor(fullAnti); Table bottomTable = makeSettingsTable("Advanced"); putSettingsButton(bottomTable, bottomButton, "The glider respawns if it falls too far. Experienced players may wish to turn this off."); ImageButton statsButton = addIconButton(null, G.image("icons/stats.png"), new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { seeStats(); } }, 96, -48, 88, 88); statsButton.setColor(G.colors.grey); putSettingsButton(bottomTable, statsButton, "View aggregate and record statistics."); ImageButton aboutButton = addIconButton(null, G.infoIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { setStage(about); } }, 0, 0, 0, 0); aboutButton.setColor(G.colors.grey); putSettingsButton(bottomTable, aboutButton, "About."); // online settings: ImageButton leaderButton = addIconButton(null, G.leaderIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { actionResolver.getLeaderboardGPGS(G.constants.scoreBoard); } }, 48, -G.height / 2 / dpi + 48, 88, 88); leaderButton.setColor(G.colors.gold); ImageButton achieveButton = addIconButton(null, G.achieveIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { actionResolver.getAchievementsGPGS(); } }, -48, -G.height / 2 / dpi + 48, 88, 88); achieveButton.setColor(G.colors.blue); Table loginTable = makeSettingsTable("Online"); putSettingsButton(loginTable, achieveButton, "View achievements."); putSettingsButton(loginTable, leaderButton, "Access leaderboards."); loginTable.add(logButton).width(182 * dpi).pad(4 * dpi).colspan(2).center(); // control settings: Table controlTable = makeSettingsTable("Controls"); CheckBox twoTouchControls = new CheckBox("", cbs); twoTouchControls.setColor(G.colors.grey); twoTouchControls.getImage().setColor(fullAnti); twoTouchControls.setChecked(G.settings.twoTouch()); twoTouchControls.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.settings.setControl("TWO_TOUCH"); } }); CheckBox tiltControls = new CheckBox("", cbs); tiltControls.setColor(G.colors.grey); tiltControls.getImage().setColor(fullAnti); tiltControls.setChecked(G.settings.tilt()); tiltControls.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.settings.setControl("TILT"); } }); CheckBox dragControls = new CheckBox("", cbs); dragControls.setColor(G.colors.grey); dragControls.getImage().setColor(fullAnti); dragControls.setChecked(G.settings.oneTouch()); dragControls.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.settings.setControl("ONE_TOUCH"); } }); ButtonGroup controlGroup = new ButtonGroup(twoTouchControls, tiltControls, dragControls); controlGroup.setMaxCheckCount(1); controlGroup.setMinCheckCount(1); controlGroup.setUncheckLast(true); putSettingsButton(controlTable, twoTouchControls, "Touch on the left or right."); putSettingsButton(controlTable, tiltControls, "Tilt your device."); putSettingsButton(controlTable, dragControls, "Touch and drag."); // mode settings: Table modeTable = makeSettingsTable("Mode"); CheckBox hellMode = new CheckBox("", cbs); hellMode.setColor(G.colors.red); hellMode.getImage().setColor(fullAnti); hellMode.setChecked(G.settings.hell()); hellMode.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.settings.setMode(-1); } }); CheckBox normalMode = new CheckBox("", cbs); normalMode.setColor(G.colors.grey); normalMode.getImage().setColor(fullAnti); normalMode.setChecked(G.settings.normal()); normalMode.addListener(new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { G.settings.setMode(0); } }); ButtonGroup modeGroup = new ButtonGroup(hellMode, normalMode); modeGroup.setMaxCheckCount(1); modeGroup.setMinCheckCount(1); modeGroup.setUncheckLast(true); putSettingsButton(modeTable, normalMode, "Normal mode: catch orbs for points."); putSettingsButton(modeTable, hellMode, "Hell mode: dodge red orbs."); putActionBar(settings); putActionBar(colorSettings); putActionBar(controlSettings); putActionBar(modeSettings); putActionBar(loginSettings); putActionBar(bottomSettings); putSettingsMenu(settings); putSettingsMenu(colorSettings); colorSettings.addActor(colorTable); putSettingsMenu(controlSettings); controlSettings.addActor(controlTable); putSettingsMenu(loginSettings); loginSettings.addActor(loginTable); putSettingsMenu(modeSettings); modeSettings.addActor(modeTable); putSettingsMenu(bottomSettings); bottomSettings.addActor(bottomTable); Table aboutTable = new Table(); aboutTable.setSize(G.width, G.height - 88 * dpi); aboutTable.setPosition(0, 88 * dpi); aboutTable.add(new Label("About", labelStyle)); aboutTable.row(); Label aboutTextLabel = new Label( "Leaf on the Wind copyright 2014 Ethan Goldberg, all rights reserved.\n\nIcons made by Google and licensed under CC BY 4.0.\n\n\nThank you for playing!", labelStyleSmall); aboutTextLabel.setWrap(true); aboutTextLabel.setAlignment(Align.center, Align.center); aboutTable.add(aboutTextLabel).width(G.width / 2); ImageButton aboutBackButton = addIconButton(about, G.backIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { setStage(bottomSettings); } }, 0, -G.height / 2 / dpi + 48, buttonWidth / dpi, 88); aboutBackButton.setColor(G.colors.red); about.addActor(aboutTable); about.addActor(aboutBackButton); // instructions: //delay float d = 0f; addLabel(instructions, "This is your glider.", 0, G.height / 2 / dpi - 96, 8, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); // wait two seconds: d += 2.5; addLabel(instructions, "Touch the screen", 0, G.height / 2 / dpi - 136, 8, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); d += 1; addLabel(instructions, "on the left,", -G.width / 4 / dpi, G.height / 2 / dpi - 166, 8, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); d += 1.5; addLabel(instructions, "or the right.", G.width / 4 / dpi, G.height / 2 / dpi - 166, 8, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); d += 3; int pickUpOffset = G.size * 2; addLabel(instructions, "Catch these,", -G.width / 4 / dpi, -G.height / 6 / dpi, G.size * 2 / dpi, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); Goody i; d += 1.5; Color r = new Color(G.colors.goodyRed); r.a = 0; Color gr = new Color(G.colors.goodyGreen); gr.a = 0; Color go = new Color(G.colors.goodyGold); go.a = 0; Color b = new Color(G.colors.goodyBlue); b.a = 0; i = addDumbGoody(instructions, b, -G.width / 4 / dpi - (G.size * 2) / dpi, -G.height / 6 / dpi + pickUpOffset); i.addAction(Actions.delay(d, Actions.alpha(1))); //bounce(i, 0, 8, 0.33f, 8); bounce(i, 0, 8, 0.33f, 4); d += .5; i = addDumbGoody(instructions, gr, -G.width / 4 / dpi, -G.height / 6 / dpi + pickUpOffset); i.addAction(Actions.delay(d, Actions.alpha(1))); //bounce(i, 0.25f, 8, 0.33f, 8); bounce(i, 0.25f, 8, 0.33f, 4); d += .5; i = addDumbGoody(instructions, go, -G.width / 4 / dpi + (G.size * 2) / dpi, -G.height / 6 / dpi + pickUpOffset); i.addAction(Actions.delay(d, Actions.alpha(1))); //bounce(i, 0.5f, 8, 0.33f, 8); bounce(i, 0.5f, 8, 0.33f, 4); d += 1.5; addLabel(instructions, "not these.", G.width / 4 / dpi, -G.height / 6 / dpi, G.size * 2 / dpi, tr) .addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); d += 2; i = addDumbBaddy(instructions, r, G.width / 4 / dpi, -G.height / 6 / dpi + pickUpOffset); i.addAction(Actions.delay(d, Actions.alpha(1))); //bounce(i, 0.75f, 8, 0.33f, 8); bounce(i, 0.75f, 8, 0.33f, 4); d += 2; addIconButton(instructions, G.playIcon, new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { setStage(game); } }, G.width / 2 / dpi - buttonWidth / dpi / 2 - 4, -G.height / 2 / dpi + 48, buttonWidth / dpi, 88) .setColor(G.colors.green); addIconButton(instructions, G.image("icons/settings.png"), new ClickListener() { @Override public void clicked(InputEvent e, float x, float y) { setStage(settings); } }, -G.width / 2 / dpi + buttonWidth / 2 / dpi + 4, -G.height / 2 / dpi + 48, buttonWidth / dpi, 88) .setColor(G.colors.grey); d += 2; Color c = new Color(G.getAntiColor()); c.a = 0; addImage(instructions, G.playWrite, c, G.width / 2 / dpi - 3 * buttonWidth / 2 / dpi - 8, -G.height / 2 / dpi + 48, buttonWidth / 2 / dpi, 48) .addAction(Actions.delay(d, Actions .forever(Actions.sequence(Actions.fadeOut(fadeDur), Actions.fadeIn(fadeDur))))); /* TextButton b1 = addButton(instructions, game, "Start", 0, -G.height/2/dpi + 88f, 192, 40f); TextButton b2 = addButton(instructions, settings, "Settings", 0, -G.height/2/dpi + 40f, 192, 40f); b1.addAction(Actions.alpha(.5f)); b2.addAction(Actions.alpha(.25f)); b1.addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); b2.addAction(Actions.delay(d, Actions.fadeIn(fadeDur))); */ }